Skip to content

Instantly share code, notes, and snippets.

@ben-eb
Created September 4, 2013 20:53
Show Gist options
  • Save ben-eb/6442724 to your computer and use it in GitHub Desktop.
Save ben-eb/6442724 to your computer and use it in GitHub Desktop.
Split up the Gruntfile initConfig into individual JS files; this gist shows an example based on grunt-contrib-clean. This blog post has a more in-depth look at splitting up the Gruntfile into manageable chunks: http://www.thomasboyt.com/2013/09/01/maintainable-grunt.html
// .grunt/config/clean.js
module.exports.tempDir = ["tmp"];
module.exports = function(grunt) {
var conf = {
pkg: grunt.file.readJSON('package.json')
};
grunt.file.recurse('./.grunt/config', function(a, r, s, f) {
conf[f.replace(/\.js$/, '')] = require('./' + a);
});
grunt.initConfig(conf);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment