Skip to content

brick-js/brick.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brick.JS

NPM version Build Status Coverage Status Dependency manager

Scalable Web Development, One Brick at a Time!

Brick.JS is a HMVC style Web Application Framework for Node.js. The entire Web App is break down into a collection of interactive bricks.

  • CommonJS environment for browser-side JavaScript.
  • Template partials are associated with controllers.
  • Automatic CSS modularization.

See Brick.JS Wiki Page for tutorials.

Demo

brick-js/brick-demo is a minimal demo project for Brick.JS

Usage

var express = require('express');
var brickJs = require('brick.js');
var Liquid = require('brick-liquid');

var brk = brickJs({
    root: path.join(__dirname, 'bricks'),
    view: 'view.html',
    router: 'router.js'
});
brk.engine('.html', Liquid());

var app = express();
app.use('/', brk.express);

app.listen(3000, x => console.log('listening to 3000'));

Options

root

Type: String

Default: path.join(__dirname, 'bricks')

Optional. The root directory containing your bricks.

view

Type: String or Array<String>

Default: 'view.html'

Optional. Template file entry(s) of your brick. Can be Array of Strings, eg: ['index.hbs', 'view.html']. Brick.JS will look for corresponding template engine when rendering.

router

Type: String

Default: 'router.js'

Optional. Server-side Router, which exports a ExpressJS compliant url, and REST Routers including get, post, put, delete which accepts 4 arguments: (req, done, fail, res).

Template Engines

Template engines can be registered via .engine(<ext>, <lib>).

Available Template Engines:

Template Engine Development Guide: Template Engine Interface

Static Assets

Static assets for your bricks can be generated by brick-asset.

brick-asset support CSS Pre-Processors like LESS.

Typically, you need brick-asset all before node app.js.

Releases

No releases published

Packages

No packages published