11module . exports = function ( grunt )
22{
3- require ( 'project-grunt' ) ( grunt , {
3+ var _ = require ( 'lodash' ) ;
4+
5+ var config = require ( 'project-grunt' ) ( grunt , {
6+ autoInit : false ,
47 data : {
58 buildDir : './build' ,
69 installerDir : './installer' ,
710 }
811 } ) ;
12+
13+ // Create the tasks for building the modules
14+ // in APP mode
15+ var moduleAppTasks = [ ] ,
16+ moduleAppTasksDebug = [ ] ;
17+
18+ // Loop through the module
19+ for ( var alias in config . project . modules )
20+ {
21+ var task , app = alias + 'app' ;
22+
23+ // Use the APP uglify options
24+ task = config . uglify [ app ] = _ . cloneDeep ( config . uglify [ alias ] ) ;
25+ task . options = '<%= uglify.app.options %>' ;
26+
27+ // Use the APP replacement options
28+ task = config . replace [ app ] = _ . cloneDeep ( config . replace [ alias ] ) ;
29+ task . replacements = '<%= replace.app.replacements %>' ;
30+
31+ moduleAppTasks . push (
32+ 'clean:' + alias ,
33+ 'uglify:' + app
34+ ) ;
35+
36+ moduleAppTasksDebug . push (
37+ 'clean:' + alias ,
38+ 'concat:' + alias ,
39+ 'replace:' + app
40+ ) ;
41+
42+ // Add the less tasks if we have css
43+ if ( config . less [ alias ] )
44+ {
45+ moduleAppTasks . push ( 'less:' + alias ) ;
46+ moduleAppTasksDebug . push ( 'less:' + alias + 'Debug' ) ;
47+ }
48+ }
49+
50+ // Register new tasks
51+ grunt . registerTask ( 'moduleAppTasks' , moduleAppTasks ) ;
52+ grunt . registerTask ( 'moduleAppTasksDebug' , moduleAppTasksDebug ) ;
53+
54+ grunt . initConfig ( config ) ;
955} ;
0 commit comments