-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgulpfile.js
More file actions
33 lines (27 loc) · 815 Bytes
/
gulpfile.js
File metadata and controls
33 lines (27 loc) · 815 Bytes
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
const { dest, parallel, src, watch } = require('gulp');
const concat = require('gulp-concat');
const rename = require('gulp-rename');
const replace = require('gulp-replace');
const deploy = process.argv.includes('--deploy');
const metafile = 'src/meta.js';
const underscript = [metafile, 'src/utils/*.js', 'src/base/*.js', 'src/hooks/*.js', '!src/**/*.ignore.js'];
function buildMeta() {
return src(metafile)
.pipe(replace(/\/\/ @history[^@]*\r?\n/ig, ''))
.pipe(rename('undercards.meta.js'))
.pipe(to());
}
function build() {
return src(underscript)
.pipe(concat('undercards.user.js'))
.pipe(to());
}
function to() {
return dest('dist');
}
if (deploy) {
underscript.push('!src/**/*.local.js');
} else {
watch(underscript, build);
}
exports.default = parallel(buildMeta, build);