|
|
|
|
|
by rodp
5357 days ago
|
|
What I didn't like about Require.js is having to wrap so many portions of my code into callback functions and not being able to merge and minify code on the fly. We ended up using Browserify instead. It's a Node.js module that lets you use CommonJS-style require in your client-side code. Browserify scans your code for all requires, figures out in which order the dependencies should be loaded and merges the code. Optionally, it lets you compile CoffeeScript on the fly or use filters, such as UglifyJS (to minify the output). Another great advantage, IMO, is that Browserify can package most Node.js modules for client-side use. Instead of downloading & distributing JS libs, you can manage them as modules via NPM and require them as you would in Node.js apps. Browserify will grab the code from the module and package it for you. However, if you can't use Node.js on your server, Require.js is definitely the way to go. |
|
Browserify is great with Node. For a slightly different take on how to share code with the server, you might also want to check out https://github.com/clux/modul8 : )