diff --git a/Gruntfile.js b/Gruntfile.js index a2db929f2b2..dceb171f69d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -22,7 +22,7 @@ module.exports = function (grunt) { var key = option.replace(/\.js$/,''); // If key already exists, extend it. It is your responsibility to avoid naming collisions config[key] = config[key] || {}; - grunt.util._.extend(config[key], require(path + option)(config)); + grunt.util._.extend(config[key], require(path + option)(config,grunt)); }); // technically not required return config; diff --git a/tasks/options/requirejs.js b/tasks/options/requirejs.js index 663a1d58d95..def2cd07391 100644 --- a/tasks/options/requirejs.js +++ b/tasks/options/requirejs.js @@ -1,4 +1,4 @@ -module.exports = function(config) { +module.exports = function(config,grunt) { var _c = { build: { options: { @@ -63,15 +63,24 @@ module.exports = function(config) { } ]; + var fs = require('fs'); + var panelPath = config.srcDir+'/app/panels' + // create a module for each directory in src/app/panels/ - require('fs') - .readdirSync(config.srcDir+'/app/panels') - .forEach(function (panelName) { + fs.readdirSync(panelPath).forEach(function (panelName) { + if(!grunt.file.exists(panelPath+'/'+panelName+'/module.js')) { + fs.readdirSync(panelPath+"/"+panelName).forEach(function (subName) { + requireModules.push({ + name: 'panels/'+panelName+'/'+subName+'/module', + exclude: ['app'] + }); }) + } else { requireModules.push({ name: 'panels/'+panelName+'/module', exclude: ['app'] }); - }); + } + }); // exclude the literal config definition from all modules requireModules diff --git a/tasks/options/uglify.js b/tasks/options/uglify.js index 35ef5a81d11..cea879980b5 100644 --- a/tasks/options/uglify.js +++ b/tasks/options/uglify.js @@ -2,7 +2,7 @@ module.exports = function(config) { return { dest: { expand: true, - src: ['**/*.js', '!config.js', '!app/dashboards/*.js'], + src: ['**/*.js', '!config.js', '!app/dashboards/*.js', '!app/dashboards/**/*.js',], dest: '<%= destDir %>', cwd: '<%= destDir %>', options: {