Closed markstos closed 8 years ago
Out of scope, but you can use browserify
, webpack
, or a similar bundling tool
I don't think documenting a feature that you claim to have-- browser support-- is out of scope for a high quality module. While code should by DRY, documentation often benefits from being repeated to some degree in multiple places where it's useful.
Honestly, I tried with browserify, read some docs, tried some things and it didn't work.
This intro to browserify is typical of docs for Browserify that are found. It boils down to:
browserify js/some-file.js -o js/bundle.js
And then
From there, it’s as simple as including the file on your page like any other JS file:
<script src="js/bundle.js"></script>
Well, if you browserify on insane.js and create a bundle and load it in a script tag like that, nothing happens. insane
is not exported, require
is not exported.
Perhaps the idea is that my entire app is turned into a giant Browserify bundle, but that won't work in this case: I just want to use the insane
function the browser and it should be easy to do.
If just a couple lines of code are required, that it seems like an easy improvement to the docs. If it's an involved process, that that definitely seems worth documenting or at least referencing docs that cover the topic.
According to this site, the insane
module is not detected as one that is "browerifyable": http://browserifysearch.org/search?q=insane
@markstos insane
is a library, not supposed to be an entry point. If you want insane as a global, do browserify -s insane insane.js
, where -s insane
means "standalone" and "name it window.insane
".
Thanks for the tip!
It would be helpful if the docs explained the recommended way to load this module and it's dependencies for use in a browser.