Improve webpack integration
- added gulp build --watch - updated documentation - bundle is now loaded after DOMContentLoaded event Related to blueprint webpack Change-Id: I04c341987002687efd6713c5296b23e491aacd6f
This commit is contained in:
parent
a7e7f05e12
commit
5de7dfca10
10
gulpfile.js
10
gulpfile.js
|
@ -249,10 +249,16 @@ gulp.task('build', function(cb) {
|
|||
new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}})
|
||||
);
|
||||
}
|
||||
if (argv.watch) {
|
||||
config.watch = true;
|
||||
}
|
||||
|
||||
rimraf.sync(config.output.path);
|
||||
|
||||
webpack(config).run(function(err, stats) {
|
||||
var compiler = webpack(config);
|
||||
var run = config.watch ? compiler.watch.bind(compiler, config.watchOptions) : compiler.run.bind(compiler);
|
||||
|
||||
run(function(err, stats) {
|
||||
if (err) return cb(err);
|
||||
|
||||
gutil.log(stats.toString(WEBPACK_STATS_OPTIONS));
|
||||
|
@ -274,7 +280,7 @@ gulp.task('build', function(cb) {
|
|||
.pipe(indexFilter.restore())
|
||||
.pipe(gulp.dest(targetDir))
|
||||
.on('end', cb);
|
||||
} else {
|
||||
} else if (!config.watch) {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -60,12 +60,14 @@
|
|||
}());
|
||||
|
||||
if (hasCookies && hasStorage) {
|
||||
loadScript(
|
||||
'static/build/bundle.js?__CACHE_BUST__',
|
||||
'Failed to load compressed Fuel UI bundle. ' +
|
||||
'If you are using development environment, ' +
|
||||
'please run "gulp build" to compile Fuel UI.'
|
||||
);
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
loadScript(
|
||||
'static/build/bundle.js?__CACHE_BUST__',
|
||||
'Failed to load compressed Fuel UI bundle. ' +
|
||||
'If you are using development environment, ' +
|
||||
'please run "gulp build" to compile Fuel UI.'
|
||||
);
|
||||
});
|
||||
} else {
|
||||
showError('Fuel UI requires Cookies and LocalStorage to work');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue