Open qfox opened 8 years ago
const Bundle = require('@bem/bundle');
const bundle = new Bundle({path: './pages/index.bemjson.js'});
Bundle.isBundle(bundle); // true
bundle.bemjson; // {block: 'a', mods: {m: v}}
bundle.decl; // [{entity: {block: 'a'}, tech: null}, {entity: {block: 'a', mod: {name: m, val: v}, tech: null}]
bundle.name; // "index"
bundle.path; // "./pages/index.bemjson.js"
const intoStream = require('into-stream');
const Bundle = require('@bem/bundle');
const Builder = require('gulp-bem-bundle-builder');
const builder = new Builder({ /* ... */ });
intoStream([
// Generating virtual bundles
new Bundle({path: './pages/index.bemjson.js'}),
new Bundle({path: './pages/page1.bemjson.js'}),
new Bundle({path: './pages/page2.bemjson.js'})
])
.pipe(builder({ /* ... */ ));
We should document this primal object to show why it was separated out of the rest.
At least, there should be examples of usage: