Optimize RequireJS projects using r.js.
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-contrib-requirejs
Then add this line to your project's grunt.js
gruntfile:
grunt.loadNpmTasks('grunt-contrib-requirejs');
Inside your grunt.js
file add a section named requirejs
. This section specifies the options passed to RequireJS Optimizer.
This controls how this task (and its helpers) operate and should contain key:value pairs, see options below.
For a full list of possible options, see the r.js example build file.
requirejs: {
compile: {
options: {
baseUrl: "path/to/base",
mainConfigFile: "path/to/config.js",
out: "path/to/optimized.js"
}
}
}
--
Task submitted by Tyler Kellen.