Over the last few weeks, I’ve converted all of my open source scripts to a UMD pattern.
UMD, or Universal Module Definition, is a simple wrapper around your code that allows it to run both in a browser and on a server (and theoretically, other places, too). While not formally registered, I also added instructions on installing the scripts with NPM, Bower, and Component using the GitHub hook if any of those are your thing.
The boilerplate I use to start all of my scripts is available on GitHub if you want to give UMD a go yourself. Major kudos to Todd Motto for helping me get started.
Have any questions or comments about this post? Email me at email@example.com or contact me on Twitter at @ChrisFerdinandi.
Get Daily Developer Tips