Skip to content

Instantly share code, notes, and snippets.

@stevekane
Created May 6, 2013 20:38
Show Gist options
  • Save stevekane/5528003 to your computer and use it in GitHub Desktop.
Save stevekane/5528003 to your computer and use it in GitHub Desktop.
load tasks straiught from package.json
fs = require('fs')
packageJSON = JSON.parse(fs.readFileSync(__dirname + '/package.json', 'utf-8'))
npmTasks = []
deps = Object.keys(packageJSON.dependencies) + Object.keys(packageJSON.devDependencies)
for dep in deps
if dep.search('grunt-') isnt -1 then npmTasks.push(dep)
#DO YOUR NORMAL grunt stuff here until you get to the location where you load your Npm tasks
npmTasks.forEach( (task) ->
grunt.loadNpmTasks(task)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment