Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jhnns/browserify-bypass
A node.js browserify middleware to declare alternative requires for the browser
https://github.com/jhnns/browserify-bypass
Last synced: about 1 month ago
JSON representation
A node.js browserify middleware to declare alternative requires for the browser
- Host: GitHub
- URL: https://github.com/jhnns/browserify-bypass
- Owner: jhnns
- License: mit
- Created: 2012-06-18T10:15:54.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-06-18T16:48:46.000Z (over 12 years ago)
- Last Synced: 2024-10-14T12:45:38.120Z (2 months ago)
- Size: 102 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
browserify-bypass
=================A node.js [browserify](https://github.com/substack/node-browserify) middleware to declare alternative requires for
the browser.
Installation
------------`npm install browserify-bypass`
Example
--------To declare an alternative require for the browser write `// @browser ./path/to/browserModule.js` one line above the
require statement:```javascript
// @browser ./browserModule.js
var myModule = require("./nodeModule.js"),
// @browser ./anotherBrowserModule.js
anotherModule = require("./anotherNodeModule.js");
```To generate the browserified module just do this:
```javascript
var b = require("browserify");
b(); // init browserify with default options
b.use(require("browserify-bypass"));
b.require("./testModule.js");
```The browserified module will now look like this:
```javascript
var myModule = require("./browserModule.js"),
anotherModule = require("./anotherBrowserModule.js");
```