Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

87 lines (64 sloc) 3.486 kb

grunt-requirejs Build Status

Optimize require.js based projects

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide.

From the same directory as your project's Gruntfile and package.json, install this plugin with the following command:

npm install grunt-requirejs

Once that's done, add this line to your project's Gruntfile:

grunt.loadNpmTasks('grunt-requirejs');

Documentation

Example require js optimizer config entry:

  requirejs: {
    mytarget: {
      options: {
        dir: 'build',
        appDir: 'src',
        baseUrl: 'js',
        paths: {
          underscore: '../vendor/underscore',
          jquery: '../vendor/jquery',
          backbone: '../vendor/backbone'
        }
      }
    }
  }

You see, there is no difference in declaring your require config when your using your Gruntfile instead of using a separate requirejs config file.

Almond

If you like to replace require.js with almond.js during the build process, grunt-requirejs comes with an almond injection mode. It even can be used to convert your require script calls in your html files to call the 'almondyfied' module, instead of calling require.js that then calls (e.g. loads) the module.

For more infos please take a look at the Almond Integration document

Custom builds

For more infos please take a look at the Using Custom Builds document

Hybrid minification

For more infos please take a look at the Using Custom Builds document

Using custom r.js versions

For more infos please take a look at the Using Custom r.js versions document

Using source maps

For more infos please take a look at the Using Custom r.js versions document

Examples

xxx

Release History

Check the Changleog for more information

Contributing

If you like to file an issue or submit a pull request, please check the contributing guidelines

Contributors

Check the AUTHORS File for more information

Resources

License

Copyright (c) 2012 asciidisco Licensed under the MIT license.

Jump to Line
Something went wrong with that request. Please try again.