-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
52 lines (47 loc) · 1.12 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
const { src, dest, watch, series } = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
// Default compile
function defaultCompile() {
return src('assets/default/style.scss')
.pipe(
sass({
outputStyle: 'compressed',
})
)
.on('error', sass.logError)
.pipe(rename({ extname: '.min.css' }))
.pipe(dest('assets/css'))
}
//Scss compile
function scssCompile() {
return src('src/scss/pages/**/*.scss')
.pipe(
sass({
outputStyle: 'compressed',
})
)
.on('error', sass.logError)
.pipe(rename({ extname: '.min.css' }))
.pipe(dest('assets/css'));
}
//Js compile
function jsCompile() {
return src('src/scripts/**/*.js')
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(dest('assets/js'));
}
//Watch
function watchCompilers() {
watch('assets/default/style.scss', defaultCompile);
watch('src/scss/**/*.scss', scssCompile);
watch('src/scripts/**/*.js', jsCompile);
}
exports.default = series(
defaultCompile,
scssCompile,
jsCompile,
watchCompilers
);