Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/2do2go/requirejs-common-wrap-middleware
https://github.com/2do2go/requirejs-common-wrap-middleware
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/2do2go/requirejs-common-wrap-middleware
- Owner: 2do2go
- Created: 2013-04-17T10:28:44.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-04-14T18:55:09.000Z (almost 9 years ago)
- Last Synced: 2024-11-28T23:37:58.420Z (about 2 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RequireJS commonJS wrap middleware
Easiest way to share your modules between server and client side
## Usage
Sample config
```js
var config = {
baseUrl: '/js/',
basePath: 'static/js/',
modules: {
'your/module/url': {
path: 'path/to/module'
},
// example with dependencies mapping
'your/another/module/url': {
path: 'path/to/another/module',
dependenciesMap: {
'original/dependency/path': 'new/dependency/url'
}
}
}
};
```As a middleware
```js
var app = express.createServer();
app.use(require('requirejs-common-wrap-middleware').wrapper(config));
```for production at a build script:
```js
require('requirejs-common-wrap-middleware').builder(config);
```You can use the same config for wrapper and builder, but
wrapper does not use `basePath` option, in opposite, builder does not use
`baseUrl` option, but use basePath.