mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
minify bundle task
This commit is contained in:
20
gulpfile.js
20
gulpfile.js
@ -158,17 +158,21 @@ gulp.task('bundle', ['transpile'], function(done){
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
var config = require('./scripts/npm/ionic.webpack.config.js');
|
var config = require('./scripts/npm/ionic.webpack.config.js');
|
||||||
bundle({
|
bundle({ config: config, stats: true });
|
||||||
config: config,
|
|
||||||
cb: finished,
|
// build minified bundle
|
||||||
stats: true
|
var minConfig = require('./scripts/npm/ionic.min.webpack.config.js');
|
||||||
});
|
bundle({ config: minConfig, cb: finished, stats: true });
|
||||||
|
|
||||||
|
var outputPaths = [
|
||||||
|
config.output.path + path.sep + config.output.filename,
|
||||||
|
minConfig.output.path + path.sep + minConfig.output.filename
|
||||||
|
];
|
||||||
|
|
||||||
function finished(){
|
function finished(){
|
||||||
var outputPath = config.output.path + path.sep + config.output.filename;
|
gulp.src(outputPaths)
|
||||||
gulp.src(outputPath)
|
|
||||||
.pipe(connect.reload())
|
.pipe(connect.reload())
|
||||||
.on('end', done)
|
.on('end', done);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
38
scripts/npm/ionic.min.webpack.config.js
Normal file
38
scripts/npm/ionic.min.webpack.config.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
var webpack = require('webpack');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: [
|
||||||
|
"./dist/ionic.js"
|
||||||
|
],
|
||||||
|
output: {
|
||||||
|
path: 'dist/bundles',
|
||||||
|
filename: 'ionic.min.js',
|
||||||
|
libraryTarget: 'commonjs2'
|
||||||
|
},
|
||||||
|
externals: [
|
||||||
|
{
|
||||||
|
'angular2/core': {
|
||||||
|
commonjs2: ['angular2', 'core']
|
||||||
|
},
|
||||||
|
'angular2/common': {
|
||||||
|
commonjs2: ['angular2', 'common']
|
||||||
|
},
|
||||||
|
'angular2/router' : {
|
||||||
|
commonjs2: ['angular2', 'router']
|
||||||
|
},
|
||||||
|
'angular2/http': {
|
||||||
|
commonjs2: ['angular2', 'http']
|
||||||
|
},
|
||||||
|
'angular2/platform/browser': {
|
||||||
|
commonjs2: ['angular2', 'platform', 'browser']
|
||||||
|
},
|
||||||
|
'angular2/instrumentation': {
|
||||||
|
commonjs2: ['angular2', 'instrumentation']
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
plugins:[ new webpack.optimize.UglifyJsPlugin({
|
||||||
|
compress: { warnings: false },
|
||||||
|
sourceMap: false
|
||||||
|
})]
|
||||||
|
};
|
Reference in New Issue
Block a user