0.0.1-alpha.2 • Published 7 years ago

gulp-mangle-systemjs-bundles v0.0.1-alpha.2

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

gulp-mangle-systemjs-bundles

Gulp stream to mangle the module IDs and imports/exports contained in SystemJS bundle files.

This is a very early prerelease version and should not be used by the general public. It uses fragile regex replacement that will be converted to use uglify-es's AST in the future.

Install

npm install --save-dev gulp-mangle-systemjs-bundles

Usage

gulpfile.js

const gulp = require("gulp");
const rename = require("gulp-rename");
const mangleBundles = require("gulp-mangle-systemjs-bundles");

//TODO: Create a better example with options, runSequence to combine bundle and config tasks.

const mangleOptions = {
	srcRoot: "src";
	exclude: [
		"src/keep-me"
	]
};

const mangle = mangleBundles(mangleOptions);

gulp.task("mangle-bundles", function () {
	return gulp.src("dist/bundle/*.js")
		.pipe(mangle.bundleTransform())
		.pipe(rename({ suffix: ".min" }))
		.pipe(gulp.dest(file => file.base));
});

gulp.task("mangle-bundles-config", function () {
	return gulp.src("dist/jspm.config.js", { base: "dist/" })
		.pipe(mangle.configTransform())
		.pipe(rename({ suffix: ".min" }))
		.pipe(gulp.dest(file => file.base));
});