forked from g1eny0ung/hugo-theme-dream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (38 loc) · 1.08 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
const { src, dest, watch, parallel } = require('gulp')
const sass = require('gulp-sass')
const babel = require('gulp-babel')
const uglify = require('gulp-uglify')
sass.compiler = require('node-sass')
const StylesEntry = './src/sass/**/*.scss'
const StylesOutput = './static/css'
const JsEntry = './src/js/**/*.js'
const JsOutput = './static/js'
const sassDev = () =>
src(StylesEntry)
.pipe(sass().on('error', sass.logError))
.pipe(dest(StylesOutput))
const sassWatch = () => watch(StylesEntry, sassDev)
const sassProd = () =>
src(StylesEntry)
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(dest(StylesOutput))
const jsDev = () =>
src(JsEntry)
.pipe(
babel({
presets: ['@babel/preset-env']
})
)
.pipe(dest(JsOutput))
const jsWatch = () => watch(JsEntry, jsDev)
const jsProd = () =>
src(JsEntry)
.pipe(
babel({
presets: ['@babel/preset-env']
})
)
.pipe(uglify())
.pipe(dest(JsOutput))
exports.watch = parallel(sassWatch, jsWatch)
exports.prod = parallel(sassProd, jsProd)