forked from mWater/minimongo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (40 loc) · 1.26 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const _ = require('lodash')
const gulp = require("gulp")
const gutil = require('gulp-util')
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
gulp.task('build', function(done) {
const webpackConfig = require('./webpack.config.js');
const compiler = webpack(webpackConfig);
return compiler.run(done);
});
gulp.task('build_min', function(done) {
let webpackConfig = require('./webpack.config.js');
webpackConfig = _.cloneDeep(webpackConfig);
webpackConfig.plugins = [
// Minimize
new webpack.optimize.UglifyJsPlugin({ sourceMap: false, compress: false, mangle: false })
];
webpackConfig.output.filename = "minimongo.min.js";
const compiler = webpack(webpackConfig);
return compiler.run(done);
});
gulp.task('dist', gulp.series([
'build',
'build_min'
])
);
gulp.task("test", gulp.series([
function() {
const webpackConfig = require('./webpack.config.tests.js');
const compiler = webpack(webpackConfig);
return new WebpackDevServer(compiler, { }).listen(8081, "localhost", err => {
if (err) {
throw new gutil.PluginError("webpack-dev-server", err);
}
// Server listening
return gutil.log("[webpack-dev-server]", "http://localhost:8081/mocha.html");
});
}
])
);