Scopify Browserify plugin
Tired of having multiple global requires from different libraries or frameworks?
Put at least the browserify bundle into its own scope so it doesn't spam your global namespace.
using the CLI tool
browserify entry.js -p scopify -o browserify.js
Then just throw a <script src="/browserify.js"></script>
into your HTML!
using the middleware
var express = ;var app = express;app; var bundle = __dirname + '/entry.js';bundle;app;
Then just throw a <script src="/browserify.js"></script>
into your HTML!
using createScope
bundle;
Instead of just simply require scopify you can use the createScope directly to pass options:
prepend
takes a string containing code which will be injected before the require statementappend
takes a string containing code which will be injected after the require statementrequire
do an automatically require (just a shortcut for {inject:"require('')"})