-
-
Notifications
You must be signed in to change notification settings - Fork 331
/
gulpfile.js
53 lines (45 loc) · 1.53 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
48
49
50
51
52
53
var gulp = require('gulp'),
less = require('gulp-less'),
rename = require('gulp-rename'),
cssnano = require('gulp-cssnano'),
uglify = require('gulp-uglify');
gulp.task('less', function () {
return gulp.src([
'./static/stylesheet/dark-theme.less',
'./static/stylesheet/style.less',
])
.pipe(less())
.pipe(cssnano())
.pipe(rename({
extname: '.min.css'
}))
.pipe(gulp.dest('./static/stylesheet'));
});
gulp.task('uglify', function () {
return gulp.src('./static/dark-theme/dark-theme.js')
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest('./static/dark-theme'));
});
gulp.task('cp', function () {
return gulp.src('./node_modules/font-awesome/**/*.{min.css,otf,eot,svg,ttf,woff,woff2}')
.pipe(gulp.dest('./static/font-awesome'));
});
gulp.task('pygments', function () {
return gulp.src(['./static/pygments/*.css', '!./static/pygments/*min.css'])
.pipe(cssnano())
.pipe(rename({
extname: '.min.css'
}))
.pipe(gulp.dest('./static/pygments'));
});
gulp.task('watch-less', function () {
return gulp.watch('static/stylesheet/*.less', gulp.task('less'));
});
gulp.task('watch-js', function () {
return gulp.watch('static/dark-theme/!(*.min).js', gulp.task('uglify'));
})
gulp.task('default', gulp.series(['less', 'uglify', 'cp', 'pygments']));
gulp.task('watch', gulp.series('default', gulp.parallel('watch-less', 'watch-js')));