-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
41 lines (33 loc) · 936 Bytes
/
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
'use strict';
const { series, parallel, src, dest, watch } = require('gulp');
const htmlmin = require('gulp-htmlmin');
const cssmin = require('gulp-cssmin');
const sass = require('gulp-sass');
function compileSass() {
return src('./app/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(dest('./'));
}
function minifyHTML() {
return src('./app/index.html')
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(dest('./'));
}
function minifyCSS() {
return src('./style.css')
.pipe(cssmin())
.pipe(dest('./'));
}
function watchHTML() {
return watch('./app/index.html', minifyHTML);
}
function watchCSS() {
return watch('./style.css', minifyCSS);
}
function watchSASS() {
return watch('./app/style.scss', compileSass);
}
exports.compileSass = compileSass;
exports.minifyCSS = minifyCSS;
exports.minifyHTML = minifyHTML;
exports.default = series(watchHTML, parallel(watchCSS, watchSASS));