Programmatically pass arguments to grunt task?

I figured it out. Use the <%= %> syntax in Gruntfile.js:

compass: {
  default_options: {
    src: 'components/<%= myTask.src %>',
    dest: 'build',
    require: ['zurb-foundation']
  }
}

Then you can set it in your task:

grunt.config.set('myTask.src', getSrc());

Leave a Comment