Convert any code using rfile and derivatives so that it supports browserify
npm install rfileifyrfile calls so that you can inline the file contents into your bundles.
rfile, you can also use modules which internally use rfile providing they meet the simple requirement of taking an object with dirname property as their second argument and are listed in the array of valid file names modules in index.js. Currently this is:
javascript
var rfile = require('rfile');
var html = rfile('./robot.html');
console.log(html);
`
And a robot.html
`html
beep boop
`
first npm install rfileify into your project, then:
$3
`
$ browserify -t rfileify example/main.js > bundle.js
`
now in the bundle output file,
`javascript
var html = rfile('./robot.html');
`
turns into:
`javascript
var html = "beep boop";
`
(and require('rfile') turns into undefined so you're not loading code you're never going to use).
$3
`javascript
var browserify = require('browserify');
var fs = require('fs');
var b = browserify('example/main.js');
b.transform('rfileify');
b.bundle().pipe(fs.createWriteStream('bundle.js'));
`
Direct Usage
A tiny command-line program ships with this module for easier debugging and if you just want this without any of the rest of browserify.
`
npm install rfileify -g
rfileify --help
``