Use requirejs r.js
Use r.js to build all the require.js projects of a directorys
If you haven't used grunt before, be sure to check out the Getting Started guide, as it explains how to create a gruntfile as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command:
npm install grunt-build-requirejs --save-dev
Run this task with the
grunt requirejs command.
This plugin is compatible with grunt 0.4.0rc7
The plugin will look for the build files and compile them into the specified destination.
For a full list of possible options, see the r.js example build file.
First possibility: Create a json build file
// path/to/main.build.json"paths":"dependency": "test-dependency""modules": "name": "test1""name": "test2"
Second possibility: Add a specific extension to identify the files to optimize (In this example .build.js)
// Gruntfile.jsrequirejs:compile:options://common options for all build filesfiles:expand: truecwd: root + componentssrc: '**/*.build.json' '**/*.build.js'dest: root + compiled