1.2.1 • Published 9 years ago

express-bem-bh v1.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

express-bem-bh

Gitter Build Status Coverage Status Dependency Status

bh.js engine (plugin) for express-bem

Why

To use .bh.js techs to render pages.

Installation

$ npm i express-bem-bh --save

Usage

var express = require('express');
var expressBem = require('express-bem')(/*params*/); // see the `express-bem` documentation to learn more about params

var app = express();

expressBem.bindTo(app);
expressBem.usePlugin('express-bem-bh', {
    force: true, // drops the template requiring cache for every request, it makes reason to use in development environment
    source: '_?.bh.js', // the enb-style wildcard to specify a template name (for example, it will render _index.bh.js for the index page)
    dataKey: 'data' // name of the field that will contain data into templates, see how to use below
});

app.get('/', function (req, res) {
    res.locals.bemjson = {block: 'test'};

    // any data to use into templates
    // it will be available in templates as `ctx.json().data.message`
    res.locals.message = 'Use bh with your Express application';

    res.render('pageName');
});

app.listen(3000);

License

MIT License

1.2.1

9 years ago

1.2.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago