gulp-bemjson
Process BEMJSON to HTML with BH
$ npm install --save-dev gulp-bemjson
// gulpfile.js
var gulp = require('gulp');
var bemjson = require('gulp-bemjson');
gulp.task('default', function () {
return gulp.src('src/index.bemjson.js', { read: false })
.pipe(bemjson())
.pipe(gulp.dest('dist'));
});
//page.bemjson.js
module.exports.bemjson = {
block: 'page',
tag: 'html',
content: {
elem: 'body',
tag: 'body',
content: 'Hello!'
}
};
With some BH templates, which applies for this file only:
//page.bemjson.js
module.exports.bemjson = {
block: 'page',
content: {
elem: 'body',
content: 'Hello!'
}
};
module.exports.bh = function(bh) {
bh.match('page', function(ctx, json) {
ctx.tag('html');
return [
'<!doctype html>',
json
];
});
};
What is it BEM?
MIT © Dmitry Kokorev