bundling changes

pull/1358/head
Jamie.Rees 8 years ago
parent 9305e3a66a
commit 13b6bee0eb

@ -127,8 +127,7 @@ var paths = {
},
bundle: { // This is the config for the bundler, you shouldn't need to change this
root: './',
dest: './lib/bundles/full.js',
libdest: './lib/bundles/lib.js',
dest: './lib/bundle.js',
bundle: 'app/main.js',
app: 'app/**/*',
config: {
@ -246,23 +245,12 @@ gulp.task('sass', function () {
});
// This bundles the entire application and libraries for deployment
gulp.task('bundle', function () {
var builder = new systemJSBuilder(paths.bundle.root);
builder.config(paths.bundle.config);
del.sync(path.join(paths.wwwroot, paths.bundle.dest), { force: true });
return builder.bundle(paths.bundle.bundle, path.join(paths.wwwroot, paths.bundle.dest), {
sourceMaps: true
})
})
// This bundles only third party dependencies for development
gulp.task('bundlelib', function () {
var builder = new systemJSBuilder(paths.bundle.root);
builder.config(paths.bundle.config);
del.sync(path.join(paths.wwwroot, paths.bundle.libdest), { force: true });
return builder.bundle(paths.bundle.bundle + ' - [' + paths.bundle.app + ']', path.join(paths.wwwroot, paths.bundle.libdest), {
return builder.bundle(paths.bundle.bundle + (global.full ? '' : ' - [' + paths.bundle.app + ']'), path.join(paths.wwwroot, paths.bundle.dest), {
sourceMaps: global.full
})
})
@ -281,10 +269,9 @@ gulp.task('typescript', function () {
});
gulp.task('fullvar', () => { global.full = true });
gulp.task('libs')
gulp.task('copy', ['lib', 'libcss', 'libfonts', 'libimages', 'npm', 'modules']);
gulp.task('compile', callback => runSequence('copy', 'sass', callback));
gulp.task('build', callback => runSequence('compile', 'bundlelib', callback));
gulp.task('build', callback => runSequence('compile', 'bundle', callback));
gulp.task('full', callback => runSequence('clean', 'compile', callback));
// Use this in a build server environment to compile and bundle everything

@ -1,16 +1,13 @@
System.import('/app/config.js').then((module: any) => {
var config = module.config.systemJS;
System.config({
baseURL: '/lib',
packages: {
'.': {
defaultExtension: 'js'
}
},
map: { app: '../app' }
})
System.config({
baseURL: '/lib',
packages: {
'.': {
defaultExtension: 'js'
}
},
map: { app: '../app' }
})
System.import(config.bundle ? 'bundles/full' : 'bundles/lib').then(() => {
System.import('/app/main');
})
});
System.import('bundle').then(() => {
System.import('/app/main');
})
Loading…
Cancel
Save