-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (38 loc) · 1 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
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const babel = require('gulp-babel');
const cleanCSS = require('gulp-clean-css');
const htmlmin = require('gulp-htmlmin');
const jsonminify = require('gulp-jsonminify');
const stripDebug = require('gulp-strip-debug');
const dest = 'dist/';
const src = 'src/';
function build() {
gulp.src(`${src}**/*.js`)
.pipe(babel({
presets: ['es2015'],
}))
.pipe(stripDebug())
.pipe(uglify())
.pipe(gulp.dest(dest));
gulp.src(`${src}**/*.css`)
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(gulp.dest(dest));
gulp.src(`${src}**/*.html`)
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest(dest));
gulp.src(`${src}**/*.json`)
.pipe(jsonminify())
.pipe(gulp.dest(dest));
gulp.src(`${src}**/*.png`)
.pipe(gulp.dest(dest));
}
function watch() {
gulp.watch([ `${src}**/*` ], [ 'build' ]);
}
gulp.task('build', build);
gulp.task('watch', watch);
gulp.task('default', [
'watch',
'build',
]);