gruntjsrequirejsgrunt-requirejs

grunt requirejs multitask and multiple files


I'm using the following method to optimize multiple modules (optimizing multiple) and everything works fine when I am not using the multitask configuration.

This works:

'requirejs': require('./build_config/requirejs.js')(grunt, config)

This doesn't:

'requirejs': {
'task1': require('./build_config/requirejs.js')(grunt, config)

}

where requirejs.js is as follows: The gist


Solution

  • based off the "options['task' + x]" reference it looks like you're putting your tasks inside the task1 task def which doesn't work. if you want to run all your requirejs tasks then you can just run "grunt requirejs". if you want to combine static and dynamically defined config then you could...

    var requirejsTasks = { ... }
    _.extend( requirejsTasks, require('./build_config/requirejs.js')(grunt, config) );