requirejs-middleware
Middleware for Connect & Express that runs the RequireJS optimizer on demand. Production-ready and used by Mozilla Popcorn Maker.
Installation
npm install requirejs-middleware
Usage
var express = path = requirejsMiddleware = ; var app = ; app;app;app;app; app;
See the full example in examples/almond/server.js.
Options
src
- Source directory containing the RequireJS modules. Requireddest
- Destination directory to write built RequireJS modules to. Requiredbuild
- Optimize modules. When disabled, the module will be served up unchanged. Default falseonce
- Optimize modules once. Recommended for production deployments. Default falsedebug
- Output debugging information on the console. Default falsemodules
- Object containing module paths and RequireJS optimizer options. Required- string - Path to RequireJS module
baseUrl
- All modules are located relative to this path. Requiredinclude
- Include this module in the output file. Required if you are optimizing with almond.name
- Name of the module to optimize first. Defaults to almond
- string - Path to RequireJS module