-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGruntfile.js
More file actions
71 lines (63 loc) · 2.01 KB
/
Gruntfile.js
File metadata and controls
71 lines (63 loc) · 2.01 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
module.exports = function(grunt) {
var STATIC_PATH = 'projects/',
BUILD_PATH = 'pretty/';
module.exports = function(grunt) {
var config = {
tree: {
js: {
options: {
format: true,
md5: 8,
type: ['js'],
ext: {
level: 1
}
},
files: [
{
src: [STATIC_PATH],
dest: BUILD_PATH + 'data/js.json'
}
]
},
css: {
options: {
format: true,
md5: 8,
type: ['css'],
ext: {
level: 1
}
},
files: [
{
src: [STATIC_PATH],
dest: BUILD_PATH + 'data/css.json'
}
]
}
},
genStaticConfig: {
build: []
}
};
// Project Configuration
grunt.initConfig(config);
// load grunt tree module.
grunt.loadNpmTasks('grunt-tree');
grunt.registerMultiTask('genStaticConfig', 'generate static config files with js.json and css.json', function() {
grunt.config('tree.css.options.md5', false);
var files = grunt.config('tree.css.files');
files[0].dest = 'data/css.json';
grunt.config('tree.css.files', files);
grunt.config('tree.js.options.md5', false);
files = grunt.config('tree.js.files');
files[0].dest = 'data/js.json';
grunt.config('tree.js.files', files);
});
// for production
grunt.registerTask('static', ['tree']);
// for development
grunt.registerTask('buildstatic', ['genStaticConfig', 'tree']);
};
};