gruntjs/grunt-contrib-requirejs — pull request #10 by mshick (2013-02-25 16:08:23+00:00)
Title: Adding buildProfile functionality for constructing optimizer options dynamically

The purpose here is to be able to do some pre-processing prior to hitting requirejs.optimize() in order to create more complicated build options than might otherwise be possible.

In my case, I needed this functionality to do dependency path resolution, and then set the paths on the config.paths object.

I've included the ability to pass options to the build profile, and a switch to override the settings defined in grunt with those from the buildProfile. The default behavior is the grunt settings will trump anything spit out of the buildProfile.

A big difference between this and the r.js buildFile option is that this executes in a pure node environment, whereas the buildFile will be an r.js environment. Most importantly for me, buildFile wouldn't work because I needed to resolve paths relative to the buildProfile itself -- not the r.js directory.

Also included is a test, which passes for me.