-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
42 lines (35 loc) · 1.04 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
"use strict";
const gulp = require("gulp"),
concat = require("gulp-concat"),
uglify = require("gulp-uglify"),
merge = require("merge-stream"),
pipeline = require('readable-stream').pipeline,
del = require("del"),
bundleconfig = require("./distbundlesconfig.json");
function getBundles(regexPattern) {
return bundleconfig.filter(function (bundle) {
return regexPattern.test(bundle.outputFileName);
});
}
function mintoDist() {
var tasks = getBundles(/\.js$/).map(function (bundle) {
return pipeline(
gulp.src(bundle.inputFiles, { base: "." }),
uglify({
output: {
comments: "some"
}
}),
concat(bundle.outputFileName),
gulp.dest(".")
);
});
return merge(tasks);
}
function cleanDist() {
var files = bundleconfig.map(function (bundle) {
return bundle.outputFileName;
});
return del(files, { force: true });
}
exports.buildDist = gulp.series(cleanDist, mintoDist);