-
Notifications
You must be signed in to change notification settings - Fork 6
/
grunt.js
47 lines (37 loc) · 981 Bytes
/
grunt.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
/*global module:false*/
module.exports = function(grunt) {
var exec = require('child_process').exec,
log = grunt.log;
grunt.registerMultiTask('coffee', 'compiles CoffeeScript files.', function() {
var done = this.async(),
dir = this.data.dir,
dest = this.data.dest;
var cmd = 'coffee --compile --output ' + dest + ' ' + dir;
exec(cmd, [], function(error, stdout, stderr) {
if(error !== null) {
log.writeln(dir + ': failed to compile to ' + dest);
log.writeln(stderr);
done(false);
}else{
log.writeln(dir + ': compiled to ' + dest);
done(true);
}
});
});
grunt.initConfig({
pkg: '<json:package.json>',
coffee: {
dist: {
dir: 'src/',
dest: '.'
}
},
min: {
dist: {
src: ['css.js'],
dest: 'css.min.js'
}
}
})
grunt.registerTask('default', 'coffee min');
};