-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
58 lines (49 loc) · 1.13 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
'use strict'
const strip = require('gulp-strip-css-comments')
const prefix = require('gulp-autoprefixer')
const cssnano = require('gulp-cssnano')
const uglify = require('gulp-uglify')
const concat = require('gulp-concat')
const sass = require('gulp-sass')(require('sass'))
const gulp = require('gulp')
const src = {
css: ['src/sass/styles.scss'],
js: ['src/js/app.js']
}
const distCss = {
path: 'docs/vendor/css',
name: {
css: 'styles'
}
}
const distJs = {
path: 'docs/vendor/js',
name: {
js: 'app'
}
}
const css = () =>
gulp
.src(src.css)
.pipe(sass().on('error', sass.logError))
.pipe(concat(`${distCss.name.css}.min.css`))
.pipe(prefix())
.pipe(strip({ all: true }))
.pipe(cssnano())
.pipe(gulp.dest(distCss.path))
const js = () =>
gulp
.src(src.js)
.pipe(concat(`${distJs.name.js}.min.js`))
.pipe(uglify())
.pipe(gulp.dest(distJs.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)