-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
32 lines (27 loc) · 904 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
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
del = require('del'),
concat = require('gulp-concat'),
coffee = require('gulp-coffee'),
uglify = require('gulp-uglify'),
gulpif = require('gulp-if'),
compress = false;
gulp.task('scripts', function () {
del('./bin/**', {silent: true});
gulp.src('./src/**/*.coffee')
.pipe(sourcemaps.init())
.pipe(coffee({join: true}).on('error', console.error))
.pipe(gulpif(compress, concat('app.min.js'), concat('app.js')))
.pipe(gulpif(compress, uglify()))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./bin/js'));
compress = false;
});
gulp.task('watch', function () {
gulp.watch('./src/**/*.coffee', ['scripts']);
});
gulp.task('deploy', function () {
compress = true;
gulp.start('scripts');
});
gulp.task('default', ['watch', 'scripts']);