-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
77 lines (72 loc) · 2.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const { series, src, dest, watch } = require('gulp')
const concat = require('gulp-concat')
const postcss = require('gulp-postcss')
const cssnext = require('postcss-cssnext')
const sourcemaps = require('gulp-sourcemaps')
const cssnano = require('cssnano')
const less = require('gulp-less')
const autoprefixer = require('gulp-autoprefixer')
const plugins = [
cssnano({
preset: [
'advanced',
{
discardComments: {
removeAll: true
},
reduceIdents: false,
mergeIdents: false,
autoprefixer: false,
'postcss-zindex': false,
zindex: false
}
],
discardComments: {
removeAll: true
},
reduceIdents: false,
mergeIdents: false,
autoprefixer: false,
'postcss-zindex': false,
zindex: false
}),
cssnext({ browsers: ['last 1 version'] })
]
/**
* compile
*
* @returns {object} pipe result
*/
function compile() {
return src('./packages/style/*.less')
.pipe(less())
.pipe(
autoprefixer({
cascade: false
})
)
.pipe(postcss(plugins, {}))
.pipe(dest('./lib/style'))
}
const concatCSS = series(compile, function (cb) {
src(['./lib/style/*.css']).pipe(sourcemaps.init()).pipe(concat('index.css')).pipe(postcss(plugins, {})).pipe(sourcemaps.write('.')).pipe(dest('./lib/style'))
cb()
})
// function copyfont() {
// return src('src/fonts/**').pipe(dest('./lib/fonts'));
// }
// function copyimage() {
// return src('src/img/**').pipe(dest('./lib/img'));
// }
exports.compile = compile
exports.concatCSS = concatCSS
// exports.copyfont = copyfont;
// exports.copyimage = copyimage;
exports.watch = function () {
// You can use a single task
watch('./packages/style/*.less', concatCSS)
}
// exports.build = series(compile, copyfont);
// exports.default = series(concatCSS, copyfont);
exports.build = series(compile)
exports.default = series(concatCSS)