Skip to content

Instantly share code, notes, and snippets.

@logankoester
Created July 31, 2013 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save logankoester/6119979 to your computer and use it in GitHub Desktop.
Save logankoester/6119979 to your computer and use it in GitHub Desktop.
Splitting an overgrown Gruntfile into multiple files
# grunt/copy.coffee
module.exports = (grunt) ->
grunt.loadNpmTasks "grunt-contrib-copy"
build:
files: [
src: ['foo/**/*']
dest: 'build/'
,
src: ['bar.xml']
dest: 'build/'
]
#global module:false
module.exports = (grunt) ->
# Inject project configuration from files
gruntConfigDir = __dirname + '/grunt/'
require('fs-walk').walkSync gruntConfigDir, (baseDir, filename, stat) ->
if match = filename.match(/^(.*)\.coffee$/)
grunt.config.set(match[1], require(baseDir + filename)(grunt))
, (err) -> if err then console.log(err)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment