linkedin/dustjs — pull request #325 by bermi (2013-08-14 13:09:22+00:00)
Title: Adding support for CommonJS browser environments.

This commit replaces lib/server.js with lib/browser.js when the code is being bundled as CommonJS for browser environments using tools that look at the "browser" option on the package.json file as outlined on https://gist.github.com/shtylman/4339901.

The change allows to require the "dustjs-linkedin" on browser environments without having to make use of the "vm" module as it currently occurs when the lib/server.js is being bundled.

I've tested this change by running:

browserify --standalone dust . > ./dist/browserified-dust.js

and updating the test/test.html scripts to include the browserified version instead of lib/[dust,parser,compiler].js.

A sample browserified version can be found on https://gist.github.com/bermi/03ee5117c0dfca74322b. It happens to be just 7KB larger than the combined version.