Gulp task to run jspm build and produce output as a Vinyl stream.
npm install gulp-jspm-build
var jspm = require('gulp-jspm-build');
gulp.task('jspm', function(){
jspm({
bundles: [
{ src: 'app', dst: 'app.js' }
]
})
.pipe(gulp.dest('.dist'));
});
An array of bundles to create. Each object in the array specifies the
arguments to systemjs-builder
in following format.
string
- Modules to bundle. You can use jspm arithmetic expressions here.
'app'
'core + navigation + app'
'app - react'
string
- Bundled file name.
object
- Arguments to systemjs-builder
.
{ minify: true, mangle: true }
Same as options
for individual bundle but specifies common options for all
bundles.
Optional, the jspm configuration file to use.
Override sections of config.js. This could be useful if you want to change things like baseURL.
configOverride: {
baseURL: '/foo'
}
The jspm base URL, as normally specified in your package.json
under config.jspm.directories.baseURL
. Defaults to '.'
.
Create a single file executable, including all necessary dependencies and systemjs. Defaults to false
.
See the jspm documentation for more information.
var jspm = require('gulp-jspm-build');
gulp.task('jspm', function(){
jspm({
bundleOptions: {
minify: true,
mangle: true
}
bundles: [
{ src: 'app', dst: 'app.js' }
{
src: 'react + react-router',
dst: 'lib.js',
options: { mangle: false }
}
],
configOverride: {
baseURL: '/foo'
}
})
.pipe(gulp.dest('.dist'));
});