Created
July 31, 2013 07:17
-
-
Save logankoester/6119979 to your computer and use it in GitHub Desktop.
Splitting an overgrown Gruntfile into multiple files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# grunt/copy.coffee | |
module.exports = (grunt) -> | |
grunt.loadNpmTasks "grunt-contrib-copy" | |
build: | |
files: [ | |
src: ['foo/**/*'] | |
dest: 'build/' | |
, | |
src: ['bar.xml'] | |
dest: 'build/' | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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