-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
72 lines (62 loc) · 1.54 KB
/
Gruntfile.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
module.exports = function (grunt) {
"use strict";
grunt.initConfig({
ts: {
options: {
fast: "never",
additionalFlags: "--lib es6,dom" // TODO: remove after grunt-ts update
},
app: {
tsconfig: "src/tsconfig.json"
}
},
sass: {
options: {
sourceMap: false,
outputStyle: "compressed"
},
beatronome: {
files: {
"styles/beatronome.css": "sass/beatronome.scss"
}
}
},
uglify: {
options: {
sourceMap: false
},
app: {
files: {
"scripts/app/app.min.js": ["scripts/app/app.js"]
}
}
}
});
var runTypescript = function(pGrunt) {
var startTime = new Date().getTime();
var done = pGrunt.async();
var nodeBin = process.argv[0]; //path to node js
grunt.util.spawn({
cmd: nodeBin,
args: [
"node_modules/typescript/bin/tsc",
"--p", pGrunt.data.tsconfig
],
opts: {stdio: 'inherit'}
}, function(pError) {
if (pError == null) {
var time = (new Date().getTime() - startTime) / 1000;
var message = 'TypeScript compilation complete: ' + time.toFixed(2) + 's';
grunt.log.writeln(message.green);
}
done(pError == null);
});
};
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks("grunt-sass");
grunt.task.registerMultiTask("ts", "Build typscript", function(){ runTypescript(this); });
grunt.registerTask("default", [
"ts:app",
"sass:beatronome"
]);
};