-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.babel.js
66 lines (59 loc) · 1.7 KB
/
gulpfile.babel.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import gulp from 'gulp';
import svgmin from 'gulp-svgmin';
import iconfont from 'gulp-iconfont';
import nunjucks from 'gulp-nunjucks';
import sourcemaps from 'gulp-sourcemaps';
import nodemon from 'gulp-nodemon';
import plumber from 'gulp-plumber';
import babel from 'gulp-babel';
import eslint from 'gulp-eslint';
import Cache from 'gulp-file-cache';
import del from 'del';
const cache = new Cache();
gulp.task('clean:server', () => {
return del(['.dist/**', '.gulp-cache']);
});
gulp.task('server', () => {
return gulp.src('./src/**/*.js')
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(cache.filter())
.pipe(eslint())
.pipe(eslint.format())
.pipe(babel())
.pipe(cache.cache())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./.dist'));
});
gulp.task('server:develop', gulp.series('server', () => {
nodemon({
script: '.dist/server.js',
watch: ['.'],
ext: 'js yaml',
ignore: ['node_modules/', 'ui/', '.uibuild/', '.dist/'],
tasks: ['server'],
});
}));
const iconTimestamp = ~~(Date.now() / 1000);
gulp.task('fe:iconfont', () => {
return gulp
.src('ui/misc/icons/*.svg')
.pipe(svgmin())
.pipe(gulp.dest('ui/misc/icons'))
.pipe(iconfont({
fontHeight: 1000,
prependUnicode: false,
descent: 6.25 / 100 * 1000,
fontName: 'vj4icon',
formats: ['svg', 'ttf', 'eot', 'woff', 'woff2'],
timestamp: iconTimestamp,
}))
.on('glyphs', (glyphs, options) => {
gulp
.src(`ui/misc/icons/template/*.styl`)
.pipe(nunjucks.compile({ glyphs, options }))
.pipe(gulp.dest('ui/misc/.iconfont'));
})
.pipe(gulp.dest('ui/misc/.iconfont'));
});
gulp.task('default', gulp.series('server:develop'));