-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
47 lines (40 loc) · 1.26 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
var gulp = require('gulp');
var gutil = require('gulp-util');
var coffee = require('gulp-coffee');
var exec = require('gulp-exec');
var rename = require('gulp-rename');
var config = {
watchers: {
index: '*.coffee',
files: 'src/**/*.coffee'
},
index: {src: 'index.ios.coffee', dist: './'},
files: {src: 'src/**/*.coffee', dist: './dist'}
}
gulp.task('build', function() {
var options = {
continueOnError: false, // default = false, true means don't emit error event
pipeStdout: true
};
gulp.src(config.files.src)
.pipe(exec('cjsx-transform <%= file.path %>', options))
.pipe(rename(function (path) {
path.extname = '.js';
}))
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(gulp.dest(config.files.dist));
});
gulp.task('cjsx', ['build'], function() {
var options = {
continueOnError: false, // default = false, true means don't emit error event
pipeStdout: true
};
gulp.src(config.index.src)
.pipe(exec('cjsx-transform <%= file.path %>', options))
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(gulp.dest(config.index.dist));
});
gulp.task('watch', ['cjsx'], function() {
gulp.watch([config.watchers.index, config.watchers.files], ['cjsx']);
});
gulp.task('default', ['watch']);