browserify-requireify
v0.2.0
Published
Require any type of file when using browserify
Downloads
51
Readme
requireify
A browserify transform for require()
-ing non-JS
files. Should work with browserify >= 5.x.x.
It accomplishes this by wrapping the contents of the file in a module.exports = '<contents>'
block.
Installation
Install via NPM: npm install browserify-requireify
requireify
is already taken :(
Usage
var browserify = require('browserify'),
requireify = require('browserify-requireify');
var b = browserify([ 'my/files/and/stuff.js' ]);
b.transform(requireify({
extensions: [ 'txt', 'html', 'css' ]
}));
b.bundle(function(err, buffer) {
console.log(buffer.toString());
});
Options
extensions
: An array of (case-insensitive) file extensions. requireify
won't do anything
if the file doesn't have an extension contained in this array.
Development
Run tests with npm test