-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJakefile.js
35 lines (27 loc) · 986 Bytes
/
Jakefile.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
var fs = require("fs")
, exec = require("child_process").exec
, spawn = require("child_process").spawn
, glob = require("glob");
desc("Watch files for changes and run downstream processes")
task("watch", [], function(params){
fs.watch('./views/client/', function (event, filename) {
jake.Task['compile'].invoke();
jake.Task['compile'].reenable(true);
});
});
desc('Compile HANDLEBARS templates')
task('compile', [], function(params) {
glob("./views/client/**/*.hbs", {}, function(error, files){
if(error) throw error;
var compile = spawn("handlebars", ["-m", "-f", "./assets/js/views/templates.compiled.js"].concat(files));
compile.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
compile.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
compile.on('exit', function (code) {
console.log('compiling templates completed with code: ' + code);
});
});
});