forked from mozilla/dxr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
68 lines (63 loc) · 2.3 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
module.exports = function(grunt) {
grunt.initConfig({
uncss: {
dev: {
files: {
'dxr/static/css/dist/dxr.css': [
'dxr/templates/*.html',
'dxr/templates/partial/*.html'
]
},
options: {
stylesheets: [
'dxr/static/css/dxr.css',
'dxr/static/css/code-style.css'
]
}
}
},
nunjucks: {
precompile: {
baseDir: 'dxr/static/templates/',
src: [
'dxr/static/templates/partial/results.html',
'dxr/static/templates/partial/switch_tree.html',
'dxr/static/templates/partial/no_results.html',
'dxr/static/templates/context_menu.html',
'dxr/static/templates/path_line.html',
'dxr/static/templates/results_container.html'
],
dest: 'dxr/static/js/templates.js',
options: {
name: function(filename) {
var re = /(partial\/)?(|\w+.\w{4})$/g;
return re.exec(filename)[0];
}
}
}
},
jshint: {
all: ['Gruntfile.js', 'dxr/static/js/*.js']
},
watch: {
nunjucks: {
files: [
'dxr/static/templates/partial/results.html',
'dxr/static/templates/partial/switch_tree.html',
'dxr/static/templates/partial/no_results.html',
'dxr/static/templates/context_menu.html',
'dxr/static/templates/path_line.html',
'dxr/static/templates/results_container.html'
],
tasks: ['nunjucks']
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-uncss');
grunt.loadNpmTasks('grunt-nunjucks');
grunt.registerTask('dev', ['nunjucks', 'watch']);
grunt.registerTask('lint', ['jshint', 'uncss:dev']);
grunt.registerTask('precompile', ['nunjucks']);
};