-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathGruntfile.js
More file actions
executable file
·131 lines (118 loc) · 3.58 KB
/
Gruntfile.js
File metadata and controls
executable file
·131 lines (118 loc) · 3.58 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
module.exports = function (grunt) {
grunt.initConfig({
ts: {
// Note: this seems to be not working well under grunt-ts,
// giving a tsc warning about use of the 'out' option
// (which is not present in tsconfig.json) and stopping compilation.
default : {
tsconfig: "static/tsconfig.json",
options: {
rootDir: "static",
},
},
},
exec: {
// This, however, works well with tsc 5.7.2
tsc: {
cwd: "static",
command: "tsc",
stdout: true,
stderr: true
}
},
concat: {
options: {
separator: ';\n', // Add semicolon and line break between files
},
netskrafl: {
src: ['static/js/*.js'],
dest: 'static/built/netskrafl.js',
}
},
uglify: {
explo_js: {
options: {
sourceMap: true // Add source maps
},
src: "static/built/explo.js",
dest: "static/built/explo.min.js"
},
netskrafl_js: {
options: {
sourceMap: true // Add source maps
},
src: "static/built/netskrafl.js",
dest: "static/built/netskrafl.min.js"
}
},
less: {
development: {
files: {
"static/skrafl-explo.css": ["static/skrafl-explo.less"],
"static/skrafl-curry.css": ["static/skrafl-curry.less"]
},
options: {
}
},
production: {
files: {
"static/skrafl-explo.css": ["static/skrafl-explo.less"],
"static/skrafl-curry.css": ["static/skrafl-curry.less"]
},
options: {
cleancss: true
}
}
},
clean: {
built: ["static/built/*"]
},
watch: {
options: {
spawn: false,
interrupt: true, // Interrupt previous tasks when new changes occur
atBegin: true // Run tasks when watch starts
},
ts: {
files: ["static/src/*.ts"],
tasks: ["ts"],
options: { spawn: false }
},
js: {
files: ["static/js/*.js"],
tasks: ["concat:netskrafl", "uglify:netskrafl_js"],
options: { spawn: false }
},
uglify_explo: {
files: ["static/built/explo.js"],
tasks: ["uglify:explo_js"],
options: { spawn: false }
},
uglify_netskrafl: {
files: ["static/built/netskrafl.js"],
tasks: ["uglify:netskrafl_js"],
options: { spawn: false }
},
less: {
files: ["static/*.less"],
tasks: ["less:development", "less:production"],
options: { spawn: false }
},
configFiles: {
files: "Gruntfile.js"
}
}
});
// Load Grunt tasks declared in the package.json file
require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);
grunt.registerTask("default", ["watch"]);
grunt.registerTask("make", ["clean", "exec:tsc", "concat", "uglify", "less"]);
// On watch events configure jshint:all to only run on changed file
grunt.event.on("watch", function(action, filepath) {
console.log("watch: " + filepath);
/*
if (startsWith(filepath, "static/js/") || startsWith(filepath, "static\\js\\"))
grunt.config("jshint.all.src", [ filepath ]);
*/
});
};