-
-
Notifications
You must be signed in to change notification settings - Fork 169
/
gulpfile.js
51 lines (43 loc) · 990 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
41
42
43
44
45
46
47
48
49
50
51
'use strict'
const postcss = require('gulp-postcss')
const concat = require('gulp-concat')
const uglify = require('gulp-uglify')
const gulp = require('gulp')
const src = {
css: ['src/css/style.css'],
js: ['src/js/main.js']
}
const dist = {
path: 'static',
name: {
css: 'style',
js: 'main'
}
}
const styles = () =>
gulp
.src(src.css)
.pipe(concat(`${dist.name.css}.min.css`))
.pipe(
postcss([
require('postcss-focus'),
require('cssnano')({
preset: require('cssnano-preset-advanced')
})
])
)
.pipe(gulp.dest(dist.path))
const scripts = () =>
gulp
.src(src.js)
.pipe(concat(`${dist.name.js}.min.js`))
.pipe(uglify())
.pipe(gulp.dest(dist.path))
const build = gulp.parallel(styles, scripts)
function watch () {
gulp.watch(src.css, styles)
gulp.watch(src.js, scripts)
}
module.exports.default = gulp.series(build, watch)
module.exports.build = build
module.exports.watch = watch