Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active December 28, 2015 02:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilmoore/7425573 to your computer and use it in GitHub Desktop.
Save wilmoore/7425573 to your computer and use it in GitHub Desktop.
Modular Gruntfile Examples
module.exports = (grunt) ->
####################################################
# diagnostic
####################################################
# use if `--time` is present
require('time-grunt')(grunt) if grunt.option 'time'
####################################################
# configuration
####################################################
configuration =
common: require "./.grunt/conf/common"
connect: require "./.grunt/conf/connect"
open: require "./.grunt/conf/open"
grunt.config.init configuration
####################################################
# task loading
####################################################
# custom tasks
grunt.loadTasks grunt.config('common.TASKS_PATH')
# installed npm tasks
require('load-grunt-tasks')(grunt)
# register default task
grunt.registerTask 'default', [ 'connect:server:keepalive' ]
# npm install --save-dev load-grunt-tasks require-grunt-configs
module.exports = (grunt) ->
# load all configuration files
grunt.config.init require("require-grunt-configs")(grunt, ".grunt/conf")
# load custom tasks
grunt.loadTasks grunt.config("common.TASKS_PATH")
# load installed npm tasks
require("load-grunt-tasks") grunt
# register default task
grunt.registerTask "default", [ "connect:server:keepalive" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment