gulp-bemjson

0.1.2 • Public • Published

gulp-bemjson Build Status Dependency Status

Process BEMJSON to HTML with BH

Install

$ npm install --save-dev gulp-bemjson

Usage

// 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?

License

MIT © Dmitry Kokorev

Package Sidebar

Install

npm i gulp-bemjson

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • molforp