An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Brick.JS

[![NPM version](https://img.shields.io/npm/v/brick.js.svg?style=flat)](https://www.npmjs.org/package/brick.js)
[![Build Status](https://travis-ci.org/brick-js/brick.js.svg?branch=master)](https://travis-ci.org/brick-js/brick.js)
[![Coverage Status](https://coveralls.io/repos/github/brick-js/brick.js/badge.svg?branch=master)](https://coveralls.io/github/brick-js/brick.js?branch=master)
[![Dependency manager](https://david-dm.org/harttle/brick-js/brick.js.svg)](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