• Stars
    star
    300
  • Rank 138,315 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

RequireJs (r.js) plugin for grunt.js

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');

Overview

Inside your Gruntfile.js file add a section named requirejs. This section specifies the options passed to RequireJS Optimizer.

Parameters

options object

This controls how this task (and its helpers) operate and should contain key:value pairs, see options below.

Options

For a full list of possible options, see the r.js example build file.

Config Example

Example require js optimizer config entry:

  requirejs: {
    compile: {
      options: {
        baseUrl: "path/to/base",
        mainConfigFile: "path/to/config.js",
        out: "path/to/optimized.js"
      }
    }
  }

There is no difference between declaring your require config in your Gruntfile and using a separate requirejs config file.

Note: Minification via Closure Compiler is not supported! You can, however, use grunt-closure-compiler as a separate build step after grunt-requirejs.

Almond

grunt-requirejs is capable of replacing require.js with almond.js automatically

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

Using custom r.js versions

grunt-requirejs lets you specify a custom r.js for your build

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

Using source maps

grunt-requirejs can generate sourcemaps when using the r.js v2.1.2 or higher

For more infos please take a look at the Using Source Maps document

Examples

There are some project & configuration examples to get you started:

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 Sebastian Golasch Licensed under the MIT license.

More Repositories

1

plugin.video.netflix

Inputstream based Netflix plugin for Kodi
Python
1,236
star
2

web-conferences-2018

A list of Web & JavaScript related conferences happening in 2018.
597
star
3

Backbone.Mutators

Backbone plugin to override getters and setters with logic
JavaScript
228
star
4

grunt-imagine

Grunt tasks for optimizing & inlining images
JavaScript
153
star
5

grunt-patternprimer

Grunting grunts with grunt & serving a pattern catalogue
JavaScript
120
star
6

Backbone.Marionette.Handlebars

Spice up your Backbone.Marionette application with some handlebars flavour
JavaScript
72
star
7

Backbone.Rpc

Backbone.js Plugin for using Json Rpc interfaces
JavaScript
50
star
8

cfp-magick

Show JavaScript and Web conferences with open calls for papers in your terminal
JavaScript
49
star
9

Backbone.Chosen

One Collection, different models, mapped easy via configuration
JavaScript
48
star
10

deepspeech-demo

Demo App for Mozillas DeepSpeech project
JavaScript
16
star
11

serveit2

Quick & dirty static HTTP2 server
JavaScript
15
star
12

grunt-backbonebuilder

Build your customized backbone experience with grunt
JavaScript
14
star
13

grunt-jquerybuilder

Build your customized jquery experience with grunt
JavaScript
11
star
14

grunt-lodashbuilder

Build your Lo-Dash experience with grunt
JavaScript
9
star
15

firefox-element-screenshots

Screenshots single elements from Webpages using Firefox
JavaScript
8
star
16

jsdays-workshop

Demo for the JavaScript Days Workshop 2014
CSS
7
star
17

awb2ics

Abfuhrkalender ICS Generator fรผr AWB Kรถln
JavaScript
7
star
18

webusb-workshop

Learn how to steer POS printers with WebUSB
HTML
7
star
19

sloccount

Counts lines of code of HTML, CSS & JS - Outputs them in a Jenkins compatible format
JavaScript
6
star
20

require-messageformat-plugin

Simple requirejs wrapper around messageformat.js
JavaScript
6
star
21

nightlybuild.io

Page of the Nightlybuild.io conference
HTML
6
star
22

node-homeland

Interface for HM-CFG-USB2 & HM-CFG-LAN as well as an implementation for the BidCos protocol
JavaScript
6
star
23

Backbone.Utils

A few nice snippets around backbone that are not big enough to deserve their own plugin
JavaScript
5
star
24

plugin.video.telekom-sport

Telekom Sport Plugin for Kodi Mediacenter
Python
2
star
25

kodinerds-iptv-proxy

Python
2
star
26

audit-badge

Generates an npm audit badge
JavaScript
2
star
27

about.me

About me
1
star
28

grunt-sloccount

A grunt plugin for generating sloccount compatible reports
JavaScript
1
star
29

asciidisco.com

My blog & site reachable under asciidisco.com (soon)
JavaScript
1
star
30

kodi-release-helper

Kodi Release Helper
Python
1
star
31

grunt-documantix

Creates html doc stuff from docBlock comments
JavaScript
1
star