0.1.2 • Published 10 years ago

gulp-bemjson v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

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