-
Notifications
You must be signed in to change notification settings - Fork 75
/
gulpfile.js
48 lines (38 loc) · 1.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
48
var gulp = require('gulp');
var NODE_ENV = process.env.NODE_ENV || 'development';
// CSS
var myth = require('gulp-myth');
gulp.task('css', function() {
return gulp.src('client/css/app.css')
.pipe(myth({
source: 'client/css'
}))
.pipe(gulp.dest('public/css'));
});
gulp.task('watch-css', function() {
return gulp.watch('client/css/**/*.css', ['css']);
});
// Image
gulp.task('image', function() {
return gulp.src('client/images/**/*')
.pipe(gulp.dest('public/images'));
});
gulp.task('watch-image', function() {
return gulp.watch('client/images/**/*', ['image']);
});
// JavaScript
var browserify = require('gulp-browserify');
var uglify = require('gulp-uglify');
gulp.task('js', function() {
var stream = gulp.src('client/js/*.js').pipe(browserify());
if (NODE_ENV === 'production') {
stream.pipe(require('gulp-uglify')());
}
stream.pipe(gulp.dest('public/js'));
return stream;
});
gulp.task('watch-js', function() {
return gulp.watch('client/js/**/*.js', ['js']);
});
gulp.task('build', ['css', 'js', 'image']);
gulp.task('watch', ['watch-css', 'watch-js', 'watch-image']);