Small set of plugins for RequireJS. Some plugins may also work on other AMD loaders (never tested it).
For more plugins check RequireJS Wiki.
You can use bower to install it easily:
bower install --save requirejs-plugins
- async : Useful for JSONP and asynchronous dependencies (e.g. Google Maps).
- font : Load web fonts using the WebFont Loader API
- goog : Load Google APIs
- image : Load image files as dependencies. Option to "cache bust".
- json : Load JSON files and parses the result. (Requires
- mdown : Load Markdown files and parses into HTML. (Requires
text!plugin and a markdown converter).
- noext : Load scripts without appending ".js" extension, useful for dynamic scripts.
- propertyParser : Just a helper used by some plugins to parse arguments (not a real plugin).
examples folder. All the info you probably need will be inside
comments or on the example code itself.
Put the plugins inside the
baseUrl folder (usually same folder as the main.js
file) or create an alias to the plugin location:
require;//use plugins as if they were at baseUrl;
Removing plugin code after build
nowadays have the
stubModules setting which can be used to remove the whole
// will remove whole source code of "json" and "text" plugins during build// JSON/text files that are bundled during build will still work fine but// you won't be able to load JSON/text files dynamically after buildstubModules : 'json' 'text'
Notes about the Markdown plugin
The Markdown plugin was created mainly to be used to compile the markdown files
into HTML during the build step, if you set
it will remove the
mdown.js files from the build.
Example build settings:
baseUrl : './'pragmasOnSave :excludeMdown : truepaths :mdown : 'lib/requirejs/mdown'text : 'lib/requirejs/text'markdownConverter : 'lib/Markdown.Converter'modules :name : 'main'
excludeMdown=true you won't be able to load markdown files dynamically
after the build.
Writing your own plugins
Check RequireJS documentation for a basic reference and use other plugins as reference. RequireJS official plugins are a good source for learning.
Also be sure to check RequireJS Wiki.
All the plugins are released under the MIT license.