-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
31 lines (27 loc) · 819 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
const gulp = require('gulp');
const gutil = require('gulp-util');
const include = require("gulp-include");
const coffeescript = require('gulp-coffeescript');
const chug = require('gulp-chug');
// get arguments with '--'
var args = []
for(var i=0, argv= process.argv, len = argv.length; i < len; ++i)
if(argv[i].startsWith('--'))
args.push(argv[i])
/* compile gulp-file.coffee */
var exitCode = 0
compileRunGulp= function(){
return gulp.src('gulp-file.coffee')
.pipe( coffeescript({bare: true}) )
.pipe( chug({args: args}) )
.on('error', function(err){
console.error('\x1b[41mERROR At ', err.plugin, '>>', err.message, '\x1b[0m');
exitCode = 1
});
};
process.on('exit', function(code){
if(exitCode) // when error
process.exit(exitCode);
});
// default task
gulp.task('default', compileRunGulp);