-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.js
35 lines (28 loc) · 915 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
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
$ = require('gulp-load-plugins')();
gulp.task('clean', function () {
return gulp.src('dist/')
.pipe($.clean());
});
gulp.task('copy', ['clean'], function () {
gulp.src(['**', '!index*.html*', '!js/**', '!lib/**', '!**/*.css'], {cwd: 'app/'})
.pipe(gulp.dest('dist/.'));
});
gulp.task('dist', ['copy'], function () {
return gulp.src('app/index.html')
.pipe($.usemin({
css: [$.cleanCss(), $.rev()],
js: [$.uglify(), $.rev()]
}))
.pipe(gulp.dest('dist/'));
});
gulp.task('serve', function() {
browserSync.init({
server: './app'
});
gulp.watch(['app/**/*.js', 'app/**/*.css', 'app/**/*.html'])
.on('change', browserSync.reload);
});
// Tell Gulp what to do when we type "gulp" into the terminal
gulp.task('default', ['serve']);