Allow for the 'src' directory to be changed to a different location.
Showing
1 changed file
with
22 additions
and
19 deletions
... | @@ -135,6 +135,9 @@ module.exports = function (grunt) { | ... | @@ -135,6 +135,9 @@ module.exports = function (grunt) { |
135 | }); | 135 | }); |
136 | 136 | ||
137 | function createConfig(mpConfig) { | 137 | function createConfig(mpConfig) { |
138 | mpConfig = _.extend({ | ||
139 | base: 'src', | ||
140 | }, mpConfig); | ||
138 | 141 | ||
139 | var featureFlags = {}; | 142 | var featureFlags = {}; |
140 | var holyGrailTmp = '.grunt/holygrail'; | 143 | var holyGrailTmp = '.grunt/holygrail'; |
... | @@ -157,7 +160,7 @@ module.exports = function (grunt) { | ... | @@ -157,7 +160,7 @@ module.exports = function (grunt) { |
157 | files: [{ | 160 | files: [{ |
158 | expand: true, | 161 | expand: true, |
159 | dot: true, | 162 | dot: true, |
160 | cwd: 'src', | 163 | cwd: mpConfig.base, |
161 | dest: 'dist/build', | 164 | dest: 'dist/build', |
162 | src: [ | 165 | src: [ |
163 | 'WEB-INF/{,*/}*.*', | 166 | 'WEB-INF/{,*/}*.*', |
... | @@ -226,7 +229,7 @@ module.exports = function (grunt) { | ... | @@ -226,7 +229,7 @@ module.exports = function (grunt) { |
226 | }), | 229 | }), |
227 | files: { | 230 | files: { |
228 | src: [ | 231 | src: [ |
229 | 'src/scripts/*.js', | 232 | mpConfig.base + '/scripts/*.js', |
230 | ], | 233 | ], |
231 | }, | 234 | }, |
232 | }, | 235 | }, |
... | @@ -239,7 +242,7 @@ module.exports = function (grunt) { | ... | @@ -239,7 +242,7 @@ module.exports = function (grunt) { |
239 | }), | 242 | }), |
240 | files: { | 243 | files: { |
241 | src: [ | 244 | src: [ |
242 | 'src/scripts/model/**/*.js', | 245 | mpConfig.base + '/scripts/model/**/*.js', |
243 | ], | 246 | ], |
244 | }, | 247 | }, |
245 | }, | 248 | }, |
... | @@ -252,15 +255,15 @@ module.exports = function (grunt) { | ... | @@ -252,15 +255,15 @@ module.exports = function (grunt) { |
252 | }), | 255 | }), |
253 | files: { | 256 | files: { |
254 | src: [ | 257 | src: [ |
255 | 'src/scripts/view/**/*.js', | 258 | mpConfig.base + '/scripts/view/**/*.js', |
256 | ], | 259 | ], |
257 | }, | 260 | }, |
258 | }, | 261 | }, |
259 | }; | 262 | }; |
260 | jshintAddExtra(mpConfig.jshint.all, initConfig.jshint, 'all'); | 263 | jshintAddExtra(mpConfig.jshint.all, initConfig.jshint, 'all'); |
261 | jshintAddExtra(mpConfig.jshint.main, initConfig.jshint.main.files, 'src'); | 264 | jshintAddExtra(mpConfig.jshint.main, initConfig.jshint.main.files, mpConfig.base); |
262 | jshintAddExtra(mpConfig.jshint.model, initConfig.jshint.model.files, 'src'); | 265 | jshintAddExtra(mpConfig.jshint.model, initConfig.jshint.model.files, mpConfig.base); |
263 | jshintAddExtra(mpConfig.jshint.view, initConfig.jshint.view.files, 'src'); | 266 | jshintAddExtra(mpConfig.jshint.view, initConfig.jshint.view.files, mpConfig.base); |
264 | checkList.push('jshint'); | 267 | checkList.push('jshint'); |
265 | } | 268 | } |
266 | 269 | ||
... | @@ -305,8 +308,8 @@ module.exports = function (grunt) { | ... | @@ -305,8 +308,8 @@ module.exports = function (grunt) { |
305 | 308 | ||
306 | initConfig.punch = { | 309 | initConfig.punch = { |
307 | options: { | 310 | options: { |
308 | 'template_dir': 'src/punch/templates', | 311 | 'template_dir': mpConfig.base + '/punch/templates', |
309 | 'content_dir': 'src/punch/contents', | 312 | 'content_dir': mpConfig.base + '/punch/contents', |
310 | plugins: { | 313 | plugins: { |
311 | parsers: { | 314 | parsers: { |
312 | '.html': 'punch-html-fragment-content-parser', | 315 | '.html': 'punch-html-fragment-content-parser', |
... | @@ -329,7 +332,7 @@ module.exports = function (grunt) { | ... | @@ -329,7 +332,7 @@ module.exports = function (grunt) { |
329 | ] | 332 | ] |
330 | }); | 333 | }); |
331 | } else { | 334 | } else { |
332 | htmlSourceDir = 'src'; | 335 | htmlSourceDir = mpConfig.base; |
333 | } | 336 | } |
334 | 337 | ||
335 | if (mpConfig.uglify) { | 338 | if (mpConfig.uglify) { |
... | @@ -381,7 +384,7 @@ module.exports = function (grunt) { | ... | @@ -381,7 +384,7 @@ module.exports = function (grunt) { |
381 | files: [{ | 384 | files: [{ |
382 | expand: true, | 385 | expand: true, |
383 | dot: true, | 386 | dot: true, |
384 | cwd: 'src', | 387 | cwd: mpConfig.base, |
385 | dest: '.grunt/usemin-css/', | 388 | dest: '.grunt/usemin-css/', |
386 | src: _.map(mpConfig.css.options.dirs, function (value) { | 389 | src: _.map(mpConfig.css.options.dirs, function (value) { |
387 | return value + '/{,**/}*.css'; | 390 | return value + '/{,**/}*.css'; |
... | @@ -409,7 +412,7 @@ module.exports = function (grunt) { | ... | @@ -409,7 +412,7 @@ module.exports = function (grunt) { |
409 | files: _.map(mpConfig.images.options.dirs, function (value) { | 412 | files: _.map(mpConfig.images.options.dirs, function (value) { |
410 | return { | 413 | return { |
411 | expand: true, | 414 | expand: true, |
412 | cwd: 'src/' + value, | 415 | cwd: mpConfig.base + '/' + value, |
413 | src: '{,**/}*.{gif,jpeg,jpg,png}', | 416 | src: '{,**/}*.{gif,jpeg,jpg,png}', |
414 | dest: 'dist/build/' + value, | 417 | dest: 'dist/build/' + value, |
415 | }; | 418 | }; |
... | @@ -421,7 +424,7 @@ module.exports = function (grunt) { | ... | @@ -421,7 +424,7 @@ module.exports = function (grunt) { |
421 | files: _.map(mpConfig.images.options.dirs, function (value) { | 424 | files: _.map(mpConfig.images.options.dirs, function (value) { |
422 | return { | 425 | return { |
423 | expand: true, | 426 | expand: true, |
424 | cwd: 'src/' + value, | 427 | cwd: mpConfig.base + '/' + value, |
425 | src: '{,**/}*.svg', | 428 | src: '{,**/}*.svg', |
426 | dest: 'dist/build/' + value, | 429 | dest: 'dist/build/' + value, |
427 | }; | 430 | }; |
... | @@ -432,7 +435,7 @@ module.exports = function (grunt) { | ... | @@ -432,7 +435,7 @@ module.exports = function (grunt) { |
432 | files: [{ | 435 | files: [{ |
433 | expand: true, | 436 | expand: true, |
434 | dot: true, | 437 | dot: true, |
435 | cwd: 'src', | 438 | cwd: mpConfig.base, |
436 | dest: 'dist/build', | 439 | dest: 'dist/build', |
437 | src: _.map(mpConfig.images.options.dirs, function (value) { | 440 | src: _.map(mpConfig.images.options.dirs, function (value) { |
438 | return value + '/{,**/}*.*'; | 441 | return value + '/{,**/}*.*'; |
... | @@ -456,7 +459,7 @@ module.exports = function (grunt) { | ... | @@ -456,7 +459,7 @@ module.exports = function (grunt) { |
456 | }); | 459 | }); |
457 | initConfig.bower = { | 460 | initConfig.bower = { |
458 | options: { | 461 | options: { |
459 | directory: 'src/' + mpConfig.bower.directory, | 462 | directory: mpConfig.base + '/' + mpConfig.bower.directory, |
460 | }, | 463 | }, |
461 | install: {}, | 464 | install: {}, |
462 | update: {}, | 465 | update: {}, |
... | @@ -496,9 +499,9 @@ module.exports = function (grunt) { | ... | @@ -496,9 +499,9 @@ module.exports = function (grunt) { |
496 | files: [{ | 499 | files: [{ |
497 | dest: 'dist/build/' + mpConfig.bower.directory + '/requirejs/require.js', | 500 | dest: 'dist/build/' + mpConfig.bower.directory + '/requirejs/require.js', |
498 | src: [ | 501 | src: [ |
499 | 'src/scripts/config.js', | 502 | mpConfig.base + '/scripts/config.js', |
500 | '.grunt/holygrail/scripts/requirejs-config.js', | 503 | '.grunt/holygrail/scripts/requirejs-config.js', |
501 | 'src/' + mpConfig.bower.directory + '/requirejs/require.js', | 504 | mpConfig.base + '/' + mpConfig.bower.directory + '/requirejs/require.js', |
502 | ], | 505 | ], |
503 | }], | 506 | }], |
504 | }; | 507 | }; |
... | @@ -513,9 +516,9 @@ module.exports = function (grunt) { | ... | @@ -513,9 +516,9 @@ module.exports = function (grunt) { |
513 | grunt.config('requireModules.' + target + '.' + grunt.config.escape(data.name), data.included); | 516 | grunt.config('requireModules.' + target + '.' + grunt.config.escape(data.name), data.included); |
514 | }, | 517 | }, |
515 | 518 | ||
516 | baseUrl: 'src/scripts', | 519 | baseUrl: mpConfig.base + '/scripts', |
517 | mainConfigFile: [ | 520 | mainConfigFile: [ |
518 | 'src/scripts/config.js', | 521 | mpConfig.base + '/scripts/config.js', |
519 | ], | 522 | ], |
520 | 523 | ||
521 | wrapShim: true, | 524 | wrapShim: true, | ... | ... |
-
Please register or sign in to post a comment