-
Notifications
You must be signed in to change notification settings - Fork 16
/
Gruntfile.js
executable file
·82 lines (70 loc) · 1.95 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
73
74
75
76
77
78
79
80
81
82
module.exports = function (grunt) {
grunt.initConfig({
ts: {
default : {
tsconfig: 'static/tsconfig.json',
options: {
rootDir: "static/src"
}
}
},
uglify: {
explo_js: {
src: 'static/built/explo.js',
dest: 'static/built/explo.min.js'
}
},
less: {
development: {
files: {
'static/skrafl-explo.css': ['static/skrafl-explo.less']
},
options: {
}
},
production: {
files: {
'static/skrafl-explo.css': ['static/skrafl-explo.less']
},
options: {
cleancss: true
}
}
},
watch: {
ts: {
files: ['static/src/*.ts'],
tasks: ['ts'],
options: { spawn: false }
},
uglify_explo: {
files: ['static/built/explo.js'],
tasks: ['uglify:explo_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', ['ts', 'uglify', 'less']);
function startsWith(s, t) {
return s.lastIndexOf(t, 0) === 0;
}
// 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 ]);
*/
});
};