-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
40 lines (35 loc) · 936 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
35
36
37
38
39
40
const { watch, src, dest, series, parallel } = require('gulp');
const less = require('gulp-less');
const clean = require('gulp-clean');
const path = require('path');
const cleanTask = () => {
return src(
[
'./assets/css/blog-enter.css',
'./assets/css/common.css',
'./assets/css/theme/*.css'
], {allowEmpty: true, read: false})
.pipe(clean());
}
const lessTask = () => {
return src(
[
'./assets/less/blog-enter.less',
'./assets/less/common.less',
'./assets/less/theme/*.less'
])
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(dest((file) => {
if (file.path.includes('theme')) {
return './assets/css/theme/';
}
return './assets/css/';
}));
}
const watchTask = () => {
return watch(['./assets/**/*.less'], series(cleanTask, lessTask));
}
exports.watch = watchTask;
exports.default = watchTask;