4
4
//
5
5
module . exports = function ( grunt ) {
6
6
7
- grunt . loadNpmTasks ( 'grunt-contrib' ) ;
7
+ grunt . loadNpmTasks ( 'grunt-contrib-clean' ) ;
8
+ grunt . loadNpmTasks ( 'grunt-contrib-jade' ) ;
9
+ grunt . loadNpmTasks ( 'grunt-contrib-cssmin' ) ;
10
+ grunt . loadNpmTasks ( 'grunt-contrib-watch' ) ;
11
+ grunt . loadNpmTasks ( 'grunt-contrib-copy' ) ;
12
+
8
13
grunt . loadTasks ( "buildtasks" ) ;
9
14
10
15
grunt . initConfig ( {
@@ -63,12 +68,29 @@ module.exports = function(grunt) {
63
68
} ,
64
69
65
70
jade : {
66
- "./" : [
67
- "src/jade/index.jade"
68
- ] ,
69
- "pages" : [
70
- "src/jade/pages/**/*.jade"
71
- ]
71
+ dynamic_mappings : {
72
+ // Grunt will search for "**/*.jade" under "client/app/modules/" when the "jade" task
73
+ // runs and build the appropriate src-dest file mappings then, so you
74
+ // don't need to update the Gruntfile when files are added or removed.
75
+ files : [
76
+ {
77
+ expand : true , // Enable dynamic expansion.
78
+ cwd : './' , // Src matches are relative to this path.
79
+ src : [ 'src/jade/index.jade' ] , // Actual pattern(s) to match.
80
+ dest : './' , // Destination path prefix.
81
+ ext : '.html' , // Dest filepaths will have this extension.
82
+ flatten : true // Remove all path parts from generated destination paths.
83
+ } ,
84
+ {
85
+ expand : true , // Enable dynamic expansion.
86
+ cwd : './' , // Src matches are relative to this path.
87
+ src : [ 'src/jade/pages/**/*.jade' ] , // Actual pattern(s) to match.
88
+ dest : 'pages' , // Destination path prefix.
89
+ ext : '.html' , // Dest filepaths will have this extension.
90
+ flatten : true // Remove all path parts from generated destination paths.
91
+ }
92
+ ]
93
+ }
72
94
} ,
73
95
74
96
prettify : {
@@ -79,12 +101,21 @@ module.exports = function(grunt) {
79
101
} ,
80
102
81
103
copy : {
82
- dist : {
83
- options : {
84
- basePath : "public/test/locales"
85
- } ,
104
+ // js: {
105
+ // options: { basePath: "client/assets/js/libs" },
106
+ // files: {
107
+ // "client/dist/release/": ["client/assets/js/libs/raphael.js", "client/assets/js/libs/infoviz.js"]
108
+ // }
109
+ // },
110
+ // css: {
111
+ // files: [
112
+ // { expand: true, cwd: 'client/assets/css', src: ['client/assets/css/font-awesome-ie7-2.0.css'], dest: 'client/dist/release/' }
113
+ // ]
114
+ // }
115
+ css : {
116
+ options : { basePath : "public/test/locales" } ,
86
117
files : {
87
- "pages/locales/" : "public/test/locales/**/*"
118
+ "pages/locales/" : [ "public/test/locales/**/*" ]
88
119
}
89
120
}
90
121
} ,
@@ -111,14 +142,18 @@ module.exports = function(grunt) {
111
142
// order and concatenate them into a single CSS file named index.css. It
112
143
// also minifies all the CSS as well. This is named index.css, because we
113
144
// only want to load one stylesheet in index.html.
114
- mincss : {
115
- "public/css/index.css" : [
116
- "public/css/bootstrap-2.0.2.css" ,
117
- "public/css/bootstrap-responsive-2.0.2.css" ,
118
- "public/css/font-awesome-2.0.css" ,
119
- "public/css/prettify.css" ,
120
- "public/css/main.css"
121
- ]
145
+ cssmin : {
146
+ compress : {
147
+ files : {
148
+ "public/css/index.css" : [
149
+ "public/css/bootstrap-2.0.2.css" ,
150
+ "public/css/bootstrap-responsive-2.0.2.css" ,
151
+ "public/css/font-awesome-2.0.css" ,
152
+ "public/css/prettify.css" ,
153
+ "public/css/main.css"
154
+ ]
155
+ }
156
+ }
122
157
} ,
123
158
124
159
// Takes the built require.js file and minifies it for filesize benefits.
@@ -193,13 +228,13 @@ module.exports = function(grunt) {
193
228
194
229
watch : {
195
230
jade : {
196
- files : "src/jade/**/*.jade" ,
197
- tasks : "build"
231
+ files : [ "src/jade/**/*.jade" ] ,
232
+ tasks : [ "build" ]
198
233
} ,
199
234
200
235
stylus : {
201
- files : "src/stylus/**/*.styl" ,
202
- tasks : "build"
236
+ files : [ "src/stylus/**/*.styl" ] ,
237
+ tasks : [ "build" ]
203
238
}
204
239
}
205
240
@@ -210,14 +245,14 @@ module.exports = function(grunt) {
210
245
// dist/debug/templates.js, compile all the application code into
211
246
// dist/debug/require.js, and then concatenate the require/define shim
212
247
// almond.js and dist/debug/templates.js into the require.js file.
213
- grunt . registerTask ( "default" , "clean jade prettify stylus copy" ) ;
248
+ grunt . registerTask ( "default" , [ "clean" , " jade" , " prettify" , " stylus" , " copy"] ) ;
214
249
215
250
// The debug task is simply an alias to default to remain consistent with
216
251
// debug/release.
217
252
//grunt.registerTask("debug", "default");
218
253
219
254
// The release task will run the debug tasks and then minify the
220
255
// dist/debug/require.js file and CSS files.
221
- grunt . registerTask ( "build" , "default mincss" ) ;
256
+ grunt . registerTask ( "build" , [ "default" , "cssmin" ] ) ;
222
257
223
258
} ;
0 commit comments