-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.js
45 lines (37 loc) · 1.09 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
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var imagemin = require('gulp-imagemin');
var open = require('gulp-open');
gulp.task('scripts', function () {
return browserify('./js/main.js')
.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('./build/js'));
});
gulp.task('css', function () {
return gulp.src('./css/**/*.css')
.pipe(gulp.dest('./build/css'));
});
gulp.task('html', function () {
return gulp.src('./*.html')
.pipe(gulp.dest('./build'));
});
gulp.task('images', function () {
return gulp.src('./public/images/**/*')
.pipe(imagemin())
.pipe(gulp.dest('./build/public/images'))
});
gulp.task('watch', function () {
gulp.watch('./js/**/*.js', ['scripts']);
gulp.watch('./css/**/*.css', ['css']);
gulp.watch('./*.html', ['html']);
});
gulp.task('open', function () {
var options = {
app: 'google chrome'
};
return gulp.src('./build/index.html')
.pipe(open('./build/index.html', options));
});
gulp.task('default', ['scripts', 'css', 'html', 'images', 'watch', 'open']);