/gulp-jspm-build

Gulp plugin for jspm.

Primary LanguageJavaScript

gulp-jspm-build

Gulp task to run jspm build and produce output as a Vinyl stream.

Build Status

Install

npm install gulp-jspm-build

Usage

var jspm = require('gulp-jspm-build');

gulp.task('jspm', function(){
    jspm({
        bundles: [
            { src: 'app', dst: 'app.js' }
        ]
    })
    .pipe(gulp.dest('.dist'));
});

Options

bundles

An array of bundles to create. Each object in the array specifies the arguments to systemjs-builder in following format.

src

string - Modules to bundle. You can use jspm arithmetic expressions here.

'app'
'core + navigation + app'
'app - react'

dst

string - Bundled file name.

options

object - Arguments to systemjs-builder.

{ minify: true, mangle: true }

bundleOptions

Same as options for individual bundle but specifies common options for all bundles.

config

Optional, the jspm configuration file to use.

configOverride

Override sections of config.js. This could be useful if you want to change things like baseURL.

configOverride: {
    baseURL: '/foo'
}

baseUrl

The jspm base URL, as normally specified in your package.json under config.jspm.directories.baseURL. Defaults to '.'.

bundleSfx

Create a single file executable, including all necessary dependencies and systemjs. Defaults to false.

See the jspm documentation for more information.

Example

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'));
});