https://github.com/brick-js/brick.js
A fully modularized Web Framework for Node.js
https://github.com/brick-js/brick.js
hmvc modular scalable server-rendering web-framework
Last synced: 21 days ago
JSON representation
A fully modularized Web Framework for Node.js
- Host: GitHub
- URL: https://github.com/brick-js/brick.js
- Owner: brick-js
- License: mit
- Created: 2015-11-16T05:03:48.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-19T14:16:53.000Z (almost 9 years ago)
- Last Synced: 2024-08-10T21:48:06.292Z (over 1 year ago)
- Topics: hmvc, modular, scalable, server-rendering, web-framework
- Language: JavaScript
- Homepage:
- Size: 235 KB
- Stars: 13
- Watchers: 7
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Brick.JS
[](https://www.npmjs.org/package/brick.js)
[](https://travis-ci.org/brick-js/brick.js)
[](https://coveralls.io/github/brick-js/brick.js?branch=master)
[](https://david-dm.org/brick-js/brick.js)
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][wiki] for tutorials.
## Demo
[brick-js/brick-demo][demo] is a minimal demo project for Brick.JS
## Usage
```javascript
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`
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(, )`.
Available Template Engines:
* [brick-hbs][brick-hbs]: Handlebars template engine for brick.js
* [brick-liquid][brick-liquid]: Liquid template engine for brick.js
> Template Engine Development Guide: [Template Engine Interface][tpl-contrib]
## Static Assets
Static assets for your *bricks* can be generated by [brick-asset][asset].
> [brick-asset][asset] support CSS Pre-Processors like LESS.
Typically, you need `brick-asset all` before `node app.js`.
[express]: http://expressjs.com/en/index.html
[brick-hbs]: https://github.com/brick-js/brick-hbs
[brick-liquid]: https://github.com/brick-js/brick-liquid
[demo]: https://github.com/brick-js/brick-demo
[wiki]: https://github.com/brick-js/brick.js/wiki
[error-page]: https://github.com/brick-js/brick.js/wiki/customize-error-page
[param-case]: https://github.com/blakeembrey/param-case
[tpl-contrib]: https://github.com/brick-js/brick.js/wiki/Template-Engine-Interface
[wiki]: https://github.com/harttle/brick.js/wiki
[asset]: https://github.com/brick-js/brick-asset