-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathGruntfile.js
102 lines (93 loc) · 2.28 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
95
96
97
98
99
100
101
102
module.exports = function(grunt){
grunt.loadNpmTasks('documentjs');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.initConfig({
documentjs: {
sites: {
"pages": {
"parent": "home",
"dest": "./",
"glob": {
"pattern": "pages/*.md",
"ignore": "{pages/guides.md,pages/guides/**/*,pages/styles.md}"
},
"templates": "theme/donejs/templates",
"static": "theme/donejs/static"
},
"examples/styles": {
"parent": "Styles",
"dest": "examples/styles",
"glob": {
"pattern": "{pages/styles.md,theme/donejs/static/styles/**/*.{less,css,md}}",
},
"templates": "theme/donejs/templates",
"static": "theme/donejs/static"
},
"examples/demos": {
"parent": "demos",
"dest": "examples/demos",
"glob": {
"pattern": "{pages/demos/index.md,pages/demos/**/*.md}"
},
"templates": "pages/demos/templates",
"static": "theme/donejs/static"
},
"guides": {
"parent": "guides",
"dest": "docs",
"glob": {
"pattern": "{pages/guides/*.md,pages/guides/**/*.md}"
},
"templates": "theme/donejs/templates",
"static": "theme/donejs/static"
}
}
},
connect: {
server: {
options: {
livereload: true,
open: true,
port: 4000
}
}
}
});
var sites = grunt.config('documentjs.sites');
for(site in sites){
grunt.config('watch.' + site, {
files: sites[site].glob.pattern,
tasks: ['documentjs:' + site],
options: {
livereload: true
}
});
grunt.config('watch.forceBuild' + site, {
files: sites[site].glob.pattern,
tasks: ['documentjs:' + site + ':forceBuild'],
options: {
livereload: true
}
});
}
grunt.registerTask('build', function(options){
options = options || {};
if(typeof options.forceBuild != 'undefined'){
for(site in sites){
grunt.config('documentjs.sites.' + site + '.forceBuild', true);
}
}
grunt.task.run('documentjs');
});
grunt.registerTask('generate', function(options){
if(options){
for(site in sites){
grunt.task.run('build:' + options, 'connect:server', 'watch')
}
}else {
grunt.task.run('documentjs', 'connect:server', 'watch');
}
});
grunt.registerTask('default', ['generate:forceBuild']);
}