Skip to content

Instantly share code, notes, and snippets.

@ranveeraggarwal
Last active March 2, 2017 18:33
Show Gist options
  • Save ranveeraggarwal/d7e88ebcc2ad31dfb2ed88f14e9bbd28 to your computer and use it in GitHub Desktop.
Save ranveeraggarwal/d7e88ebcc2ad31dfb2ed88f14e9bbd28 to your computer and use it in GitHub Desktop.
var systemjsBuilder = require('gulp-systemjs-builder');
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var includedJsFiles = [
"node_modules/core-js/client/shim.min.js",
"node_modules/zone.js/dist/zone.js",
"node_modules/reflect-metadata/Reflect.js",
"node_modules/systemjs/dist/system.src.js",
"dist/main.js"
];
var binDirectoriesAndFiles = [
"fonts/**/*",
"styles/**/*",
"views/**/*",
"favicon.ico",
"index.html",
"all.the.js"
];
gulp.task('build-sysjs', function() {
var builder = systemjsBuilder();
builder.loadConfigSync('./scripts/systemjs.config.js');
return builder.buildStatic('dist/main.js', 'dist/main.2.js', {
minify: true,
mangle: false
})
.pipe(gulp.dest('.'));
});
gulp.task('concat-uglify', ['build-sysjs'], function() {
return gulp.src(includedJsFiles)
.pipe(concat('all.the.js'))
.pipe(uglify())
.pipe(gulp.dest('.'));
});
gulp.task('copy-to-bin', ['concat-uglify'], function() {
return gulp.src(binDirectoriesAndFiles, {base: '.'})
.pipe(gulp.dest('drop'));
});
gulp.task('prod', ['build-sysjs', 'concat-uglify', 'copy-to-bin']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment