blob: 85e7920775003c606caba9af161751c3686d0a95 (
plain)
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
|
const { src, dest, watch, parallel } = require('gulp')
const sass = require('gulp-dart-sass')
const babel = require('gulp-babel')
const uglify = require('gulp-uglify')
sass.compiler = require('sass')
const StylesEntry = './src/sass/**/*.scss'
const StylesOutput = './static/css'
const JsEntry = './src/js/**/*.js'
const JsOutput = './static/js'
const sassProd = () =>
src(StylesEntry)
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(dest(StylesOutput))
const sassWatch = () => watch(StylesEntry, sassProd)
const jsProd = () =>
src(JsEntry)
.pipe(
babel({
presets: ['@babel/preset-env'],
})
)
.pipe(uglify())
.pipe(dest(JsOutput))
const jsWatch = () => watch(JsEntry, jsProd)
exports.prod = parallel(sassProd, jsProd)
exports.watch = parallel(sassWatch, jsWatch)
|