1 | var gulp = require('gulp');
|
2 | var $ = require('gulp-load-plugins')();
|
3 |
|
4 | var paths = {
|
5 | scripts: ['src/infra.coffee','src/axoid.coffee','src/commons/**/*.coffee']
|
6 | };
|
7 |
|
8 | gulp.task('scripts', function() {
|
9 | return gulp.src(paths.scripts)
|
10 | .pipe($.cached('scripts'))
|
11 |
|
12 | .pipe($.plumber())
|
13 | .pipe($.coffee())
|
14 | .on('error', console.log)
|
15 |
|
16 | .pipe($.remember('scripts'))
|
17 | .pipe($.concat('index.js'))
|
18 | .pipe(gulp.dest(''))
|
19 | .pipe($.uglify())
|
20 | .pipe($.concat('index.min.js'))
|
21 | .pipe(gulp.dest(''))
|
22 | ;
|
23 | });
|
24 |
|
25 |
|
26 | gulp.task('watch', function() {
|
27 | var watcher = gulp.watch(paths.scripts, ['scripts']);
|
28 | watcher.on('change', function (event) {
|
29 | if (event.type === 'deleted') {
|
30 | delete $.cached.caches.scripts[event.path];
|
31 | $.remember.forget('scripts', event.path);
|
32 | }
|
33 | });
|
34 |
|
35 | });
|
36 |
|
37 |
|
38 | gulp.task('build', ['scripts']);
|
39 |
|
40 |
|
41 | gulp.task('default', ['watch', 'scripts']);
|