-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (39 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
const { src, dest, watch, series } = require('gulp');
function less(cb) {
const gulp_less = require('gulp-less');
return src('./assets/less/styles.less')
.pipe(gulp_less())
.pipe(dest('./assets/css'))
cb();
}
function concat(cb) {
const gulp_concat = require('gulp-concat');
return src([
'./assets/js/lax.js',
'./assets/js/tiny-slider.js',
'./assets/js/scripts.js'
])
.pipe(gulp_concat('scripts.min.js'))
.pipe(dest('./assets/js/min'))
cb();
}
function uglify(cb) {
const gulp_uglify = require('gulp-uglify');
return src('./assets/js/min/*.js')
.pipe(gulp_uglify())
.pipe(dest('./assets/js/min'))
cb();
}
function minifyCSS(cb) {
const clean_css = require('gulp-clean-css');
return src('./assets/css/*.css')
.pipe(clean_css({ compatibility: 'ie8' }))
.pipe(dest('./assets/css'))
cb();
}
function watchFiles() {
watch('./assets/less/*.less', less);
watch('./assets/js/*.js', concat, uglify);
}
exports.default = series(watchFiles);
exports.build = series(less, concat, uglify, minifyCSS);