Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

dkokorev90/gulp-bemjson

Repository files navigation

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

About

Process BEMJSON to HTML

Resources

License

Stars

Watchers

Forks

Packages

No packages published