-
Notifications
You must be signed in to change notification settings - Fork 68
/
gulpfile.js
55 lines (47 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
46
47
48
49
50
51
52
53
54
55
'use strict'
const sass = require('gulp-sass')(require('sass'))
const postcss = require('gulp-postcss')
const uglify = require('gulp-uglify')
const concat = require('gulp-concat')
const gulp = require('gulp')
const src = {
css: ['src/sass/style.scss'],
js: ['src/js/main.js']
}
const dist = {
path: 'docs',
name: {
css: 'style',
js: 'main'
}
}
const css = () =>
gulp
.src(src.css)
.pipe(sass().on('error', sass.logError))
.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 js = () =>
gulp
.src(src.js)
.pipe(concat(`${dist.name.js}.min.js`))
.pipe(uglify())
.pipe(gulp.dest(dist.path))
const build = gulp.parallel(css, js)
const watch = () => {
gulp.watch(src.css, css)
gulp.watch(src.js, js)
}
exports.build = build
exports.css = css
exports.js = js
exports.watch = watch
exports.default = gulp.series(build, watch)