-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
47 lines (40 loc) · 1.06 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
// Recreate this configuration
// browser-sync start --proxy localhost:8080 --files="public/css/*.css", "public/js/*.js", "public/views/*.pug" --no-notify
var gulp = require('gulp');
var del = require('del');
var cleanCSS = require('gulp-clean-css');
var terser = require('gulp-terser');
function clean(cb) {
del('dist');
cb();
}
function minifyCss(cb) {
gulp.src('public/assets/css/**/*.css')
.pipe(cleanCSS({level: {1: {specialComments: 0}}}))
.pipe(gulp.dest('dist/public/assets/css'));
cb();
}
function minifyJs(cb) {
gulp.src('public/assets/js/**/*.js')
.pipe(terser({
keep_fnames: true,
mangle: false
}))
.pipe(gulp.dest('dist/public/assets/js'));
cb();
}
function moveApplication(cb) {
gulp.src(['**/*',
'!public/assets/js/**/*.js',
'!public/assets/css/**/*.css',
'!test/**',
'!server/**',
'!*.md',
'!bower.json',
'!package-lock.json',
'!gulpfile.js'])
.pipe(gulp.dest('dist'));
cb();
}
gulp.task('clean', gulp.series(clean))
gulp.task('build', gulp.parallel(moveApplication, minifyCss, minifyJs))