Skip to content

Instantly share code, notes, and snippets.

@shubik
Created August 20, 2014 21:45
Show Gist options
  • Save shubik/18851ac749027d77ddc3 to your computer and use it in GitHub Desktop.
Save shubik/18851ac749027d77ddc3 to your computer and use it in GitHub Desktop.
var _ = require('lodash');
module.exports = function(grunt) {
var prod = !!grunt.option('prod'),
path = grunt.config.get('src_path') + '/js/app/',
paths = [],
modules;
grunt.file.recurse(path, function(abspath, rootdir, subdir, filename) {
if (abspath.match(/\.js$/gi)) {
paths.push(abspath.replace(path, '').replace('.js', ''));
grunt.file.copy(abspath, abspath, {
process: function(content, srcpath) {
return content.replace(/jsx!/g, '');
}
});
}
});
modules = _.map(paths, function(path) {
return { name: path };
});
prod && grunt.config('requirejs.all.options.modules', modules);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment