-
Notifications
You must be signed in to change notification settings - Fork 14
/
Gruntfile.js
94 lines (82 loc) · 1.97 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
83
84
85
86
87
88
89
90
91
92
93
94
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jsdoc: {
configFile: 'jsdoc-conf.json',
dest: 'output'
},
less: {
development: {
options: {
paths: ['<%= copyAssets.src %>/css']
},
files: {
'<%= copyAssets.dest %>/css/style.css': '<%= copyAssets.src %>/css/style.less'
}
}
},
shell: {
'dev-guide': {
command: 'cd developer-guide && sh grunt.sh'
}
},
subst: {
'dev-guide': {
options: {
pattern: /\$dev-guide/ig,
relative: true,
base: 'output/developer-guide'
},
files: {
src: 'output/**/*.html'
}
},
'api': {
options: {
pattern: /\$api/ig,
relative: true,
base: 'output'
},
files: {
src: 'output/**/*.html'
}
},
'index': {
options: {
pattern: /\.\.\/#/g,
replacement: "../index.html#"
},
files: {
src: 'output/**/*.html'
}
},
'date': {
options: {
pattern: /{{ generated }}/g,
replacement: function() {
// Yes, obviously this doesn't need to be calculated each time. You fix it.
var d_names = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var m_names = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var d = new Date();
var curr_day = d.getDay();
var curr_date = ("0" + d.getDate()).substr(-2);
var curr_month = d.getMonth();
var curr_year = d.getFullYear();
return d_names[curr_day] + ", " + m_names[curr_month] + " " + curr_date + ", " + curr_year;
}
},
files: {
src: 'output/**/*.html'
}
}
},
copyAssets: {
src: 'assets',
dest: '<%= jsdoc.dest %>'
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-shell');
grunt.loadTasks('tasks');
grunt.registerTask('default', ['jsdoc', 'less', 'shell', 'copy-assets', 'subst']);
};