DEPRECATED repository, moved to mono repository gulp-bem
Easy to use builder for streams of BemBundle
and Vinyl
objects;
npm i gulp-bem-bundle-builder
const concat = require('gulp-concat');
const bundlerFs = require('gulp-bem-bundler-fs'); // Read bundles from FS by glob
const bundleBuilder = require('gulp-bem-bundle-builder');
// Create an instance with configuration to run typical build tasks
const builder = bundleBuilder({
config: {
levels: {
'libs/super-library/blocks': {scheme: 'nested'},
'blocks': {scheme: 'nested'}
}
},
levels: [
'libs/super-library/blocks',
'blocks'
],
techMap: {
js: ['vanilla.js', 'browser.js', 'js'],
css: ['styl', 'css']
}
});
bundlerFs('bundles/*')
.pipe(builder({
css: bundle => bundle.src('css').pipe(concat('file.css')),
js: bundle => bundle.src('js').pipe(concat('file.js'))
}))
.pipe(...) // Stream<Vinyl>
.pipe(gulp.dest('.'));
BundleBuilder({
config: ?BemConfig, // BEM-project configuration
levels: ?String[], // Levels to use for building by default
techMap: ?Object // Mapping deps to file tech
}):
function(Object<tech: String, function(bundle: BundleBuilder~Bundle): Stream<Vinyl>>):
TransformStream<Vinyl|BemBundle, Vinyl>
BemBundle
class extended by src
and target
helper methods.
Gather vinyl file objects that responde to BEM entity declaration and their dependencies and return them as a readable stream.
Bundle.src(tech: String, opts: ?Object): Stream<Vinyl>
Returns resulting stream of a target.
Bundle.target(target: String): Stream<Vinyl>
NB: Beware of cycles:
builder({
a: bundle => bundle.target('b'),
b: bundle => bundle.target('a')
});
Code and documentation copyright 2016 YANDEX LLC. Code released under the Mozilla Public License 2.0.