Automagically browserify and wire-up installed NPM modules into your AMD config
Grunt task to automatize the use of browserify for NPM modules in your AMD/RequireJS projects.
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-npm-amd --save-dev
gruntinitConfignpm_amd:target:config: 'app/config.js';gruntloadNpmTasks'grunt-npm-requirejs';gruntregisterTask'default' 'npm_amd';
npm_amd task is run it bundles installed NPM modules with browserify via NPM-AMD and merges the bundle paths into the
paths property of your AMD config file. Also it will detect AMD entries and just point the configuration to it, instead of doing pointless browserifying ;)
You trigger this task from another task in your Gruntfile or through the CLI:
Specify a relative path to your RequireJS config.
Make sure to specify the
baseUrl property in your config file if you want to use relative paths.
baseUrl: "baseUrl"paths: "paths"
Property names to look for when patching up the config file. Declare this to support other AMD loaders.
Watch that space.
config. For example, for RequireJS you need to have at least the following: