-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgulpfile.js
60 lines (51 loc) · 1.39 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
import postcss from 'gulp-postcss'
import pkg from 'gulp'
import { deleteAsync } from 'del'
import autoprefixer from 'autoprefixer'
import cssnano from 'cssnano'
import precss from 'precss'
import scss from 'postcss-scss'
import postcssColorMod from 'postcss-color-mod-function'
// const postcss = require('gulp-postcss')
// const pkg = require('gulp')
// const del = require('del')
// const autoprefixer = require('autoprefixer')
// const cssnano = require('cssnano')
// const precss = require('precss')
// const scss = require('postcss-scss')
// const postcssColorMod = require('postcss-color-mod-function')
const { task, src, dest, series, watch } = pkg
/* PostCSS */
task('clean', function () {
return deleteAsync(['./src/postcss/**'])
})
task('css', function () {
console.log('Building PostCSS...')
return src(['./src/**/*.css', '!./src/postcss/**/*.css', '!./src/b5.js/**/*'])
.pipe(
postcss(
[
// PostCSS plugins here
precss(),
postcssColorMod(),
autoprefixer(),
cssnano(),
],
{
syntax: scss,
}
)
)
.pipe(dest('./src/postcss'))
})
task('watch', function () {
task('css')()
return watch(
['./src/**/*.css', '!./src/postcss/**/*.css', '!./src/b5.js/**/*'],
series('css')
)
})
task(
'default',
series('clean', process.env.NODE_ENV === 'development' ? 'watch' : 'css')
)