-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathgulpfile.js
62 lines (50 loc) · 1008 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Gulp.js configuration
const
gulp = require('gulp'),
postcss = require('gulp-postcss'),
terser = require('gulp-terser'),
// CSS configuration
cssCfg = {
in: 'src/css/progressive-image.css',
out: 'dist/',
process: [
require('autoprefixer'),
require('cssnano')
]
},
// JS configuration
jsCfg = {
in: 'src/js/progressive-image.js',
out: 'dist/',
terser: {
mangle: {
toplevel: true
},
compress: {
passes: 5,
drop_console: true
},
output: {
quote_style: 1
},
ecma: 5,
ie8: false,
module: false
}
};
// CSS minification
function css() {
return gulp.src(cssCfg.in)
.pipe(postcss(cssCfg.process))
.pipe(gulp.dest(cssCfg.out));
}
exports.css = css;
// JS minification
function js() {
return gulp.src(jsCfg.in)
.pipe(terser(jsCfg.terser))
.pipe(gulp.dest(jsCfg.out));
}
exports.js = js;
// build
exports.default = gulp.series(css, js);