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.
brick-js/brick-demo is a minimal demo project for Brick.JS
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'));
Type: String
Default: path.join(__dirname, 'bricks')
Optional. The root directory containing your bricks.
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.
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 can be registered via .engine(<ext>, <lib>)
.
Available Template Engines:
- brick-hbs: Handlebars template engine for brick.js
- brick-liquid: Liquid template engine for brick.js
Template Engine Development Guide: Template Engine Interface
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
.