-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (35 loc) · 1.02 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
const {src,dest,watch,series} = require('gulp');
const scss = require('gulp-sass')(require('sass'));
const postcss = require('gulp-postcss');
const cssnano = require('cssnano');
const prefixer = require('autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
const terser = require('gulp-terser');
const concat = require('gulp-concat');
//scss task
const scssTask = function () {
return src('grocery/static/scss/*.scss')
.pipe(scss())
.pipe(sourcemaps.init())
.pipe(postcss([cssnano(),prefixer()]))
.pipe(sourcemaps.write('.'))
.pipe(dest('grocery/static/css'))
};
//Js task
const jsTask = function () {
return src('grocery/static/js/*.js')
.pipe(sourcemaps.init())
.pipe(terser())
.pipe(sourcemaps.write('.'))
.pipe(dest('grocery/static/minjs'))
};
//watch task
const watchTask = function () {
watch('grocery/static/scss/*.scss',{delay : 1000}, scssTask);
watch('grocery/static/js/*.js', jsTask);
};
exports.default = series(
scssTask,
jsTask,
watchTask
);