forked from ubemii/ubemii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
45 lines (40 loc) · 1.05 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
const gulp = require('gulp')
const gulpless = require('gulp-less')
const postcss = require('gulp-postcss')
const debug = require('gulp-debug')
var csso = require('gulp-csso')
const autoprefixer = require('autoprefixer')
const NpmImportPlugin = require('less-plugin-npm-import')
gulp.task('theme', function () {
const plugins = [autoprefixer()]
return gulp
.src('src/assets/less/*.less')
.pipe(debug({title: 'Less files:'}))
.pipe(
gulpless({
javascriptEnabled: true,
plugins: [new NpmImportPlugin({prefix: '~'})],
}),
)
.pipe(postcss(plugins))
.pipe(
csso({
debug: true,
}),
)
.pipe(gulp.dest('./public/css'))
})
gulp.task('less', () => {
return gulp.src('src/assets/less/index.less')
.pipe(
gulpless({
javascriptEnabled: true,
plugins: [new NpmImportPlugin({prefix: '~'})],
}),
)
.pipe(postcss([autoprefixer()]))
.pipe(gulp.dest('./src'))
});
gulp.task('watch', function () {
return gulp.watch('src/assets/less/**/*.less', gulp.series('theme', 'less'));
});