/gulp-systemjs-builder

A tiny wrapper around SystemJS builder .bundle and .buildStatic methods

Primary LanguageJavaScriptMIT LicenseMIT

Gulp SystemJS Build Tool

A tiny wrapper around SystemJS builder .bundle and .buildStatic methods. Based on SystemJS Builder. It allows use .pipe() method on output after build.

Usage

var systemjsBuilder = require('gulp-systemjs-builder')

gulp.task('build-sjs', function () {
	var builder = systemjsBuilder()
	builder.loadConfigSync('./system.config.js')

	builder.buildStatic('app/main.js', {
		minify: false,
		mangle: false
	})
	.pipe(gulp.dest('./build'));
})

Options

Initialize

To create instance of plugin use systemjsBuilder(baseURL, configFile). Works transperent to original SystemJS Builder.

var builder = systemjsBuilder('./', './system.config.js')

Load config

You can't return pipe from .loadConfig().then() method, so use .loadConfigSync to initialize systemjs.config from external file.

builder.loadConfigSync('./system.config.js')

All other options works exactly as in SystemJS Builder.

Build

You can use .bundle and .buildStatic methods like you do it in SystemJS Builder:

builder.buildStatic('myModule.js', 'outfile.js', options);

If you not set the outputfile, gulp-systemjs-builder will try to use your input filename. When you not set the output file and use arithmetic expressions in input filename, gulp-systemjs-builder will use default output filename build.js

Backward compatibility

Original SystemJS Builder methods aliased to ._bundle() and ._buildStatic()