-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
38 lines (33 loc) · 953 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
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var babel = require('gulp-babel');
var uglify = require('gulp-uglify');
var fs = require('fs-extra');
gulp.task('clean', (cb) => {
fs.removeSync('dist');
fs.removeSync('build');
cb();
});
gulp.task('minify_css', () => {
return gulp.src('src/*.css')
.pipe(cleanCSS({level: 2}))
.pipe(gulp.dest('dist/'))
done();
});
gulp.task('minify_js', () => {
return gulp.src(['src/*.js', '!src/*node.js'])
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(gulp.dest('build/optimized'))
.pipe(uglify())
.pipe(gulp.dest('build/minified'))
.pipe(gulp.dest('dist'))
done();
});
gulp.task('copy_node', () => {
return gulp.src('src/*node.js')
.pipe(gulp.dest('dist'));
done();
})
gulp.task('default', gulp.series('clean', gulp.parallel('minify_css', 'minify_js'), 'copy_node'));