gulp-parable
v0.4.1-alpha.c4156b95Parable Gulp Task
Gulp task for use with Parable. See the Parable README for more information about the options you can pass to Parable.
This documentation is still a work in progress.
Usage
Gulp only processes a single file at a time, so to take advantage of Parable the pattern to use is to precompile with Parable, to get the parallelisation benefits on all the files, and then for individual files use Parable to (hopefully) just return the file that was cached.
const gulp = require('gulp');
const parable = require('gulp-parable');
const parableOpts = {
base: 'src',
outputDir: 'target/parable',
babelOptions: {
// ...
}
};
const JS_GLOB = ['src/**/*.js'];
gulp.task('precompile-js', parable.precompile(JS_GLOB, parableOpts));
gulp.task('js', ['precompile-js'], function (cb) {
return gulp.src(JS_GLOB)
.pipe(parable.transform(parableOpts))
.on('error', function (error) {
parable.logError(error);
cb(new Error('unable to transpile ' + error.filename));
})
.pipe(gulp.dest('target'));
});
gulp.task('watch', ['js'], function () {
gulp.watch([JS_GLOB], ['js']);
});
npm i [email protected]
Metadata
- Apache-2.0
- Whatever
- Marcin Szczepanski
- released 10/5/2016