forked from liriliri/chii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
34 lines (30 loc) · 864 Bytes
/
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
const { src, dest } = require('gulp');
const uglify = require('gulp-uglify-es').default;
const clean = require('gulp-clean');
const map = require('licia/map');
const startWith = require('licia/startWith');
exports.uglify = function () {
return src(
transSrc([
'**/*.js',
'!ui/components/diff_view/diff_view.js',
'!ui/components/panel_feedback/panel_feedback.js',
'!ui/components/text_editor/text_editor.js',
'!ui/components/docs/**/*.js',
])
)
.pipe(uglify())
.pipe(dest('public/front_end'));
};
exports.clean = function () {
return src('public', { read: false, allowEmpty: true }).pipe(clean());
};
function transSrc(paths) {
return map(paths, val => {
const prefix = 'public/front_end/';
if (startWith(val, '!')) {
return '!' + prefix + val.slice(1);
}
return prefix + val;
});
}