Browserify Friend (BFF) - it is as if browserify was built into the browser.
npm install bff -g
In a directory run:
> bff server Serving contents on port 3000.
In the same directory run:
> bff build Successfully browserified your site in 'build'.
Now your site has been browserified within the
build directory and it can be served by a static web server.
To try this out, start in a new empty directory. Let's install
domify - a library to convert an html string into a DOM element
npm install domify
index.html file with just this
<body> <script src="index.js"></script> </body>
var domify = require('domify') document.body.appendChild(domify('<h1>Hello World with Browserify!</h1>'))
Start the bff server
http://localhost:3000 and see it work.
Now, if you want to generate the site so that it can be served via a static web server like Apache or Nginx, use the
Test it using the python web server
cd build python -m SimpleHTTPServer
http://localhost:8000 and see it work.
BFF configures Browserify to make all top level files requirable. This means you can do
var domify = require('domify') in the development console. You can also require any
.js file in your app using relative paths, e.g.
var app = require('./app').