different behaviour: minified and non-minified versions #722

Closed
lazylester opened this Issue Aug 27, 2012 · 3 comments

Comments

Projects
None yet
3 participants

using underscore.js:

_.template("hello <%= name %>")({name : null}) /* => "hello "

using underscore_min.js

_.template("hello <%= name %>")({name : null}) /* => "hello null"

Collaborator

braddunbar commented Aug 27, 2012

Hi @lazylester! _.template was changed a while back to handle output null or undefined values as "". The latest version in the master branch does this, but 1.3.3 does not. I'm not sure which minified file you're using, but the minified files are not updated until a release is cut so I would recommend grabbing the commented version and doing your own minification.

@braddunbar braddunbar closed this Aug 27, 2012

Contributor

jdalton commented Aug 28, 2012

@lazylester You can install the documentcloud/closure-compiler gem and then do rake build in your local underscore repo to build a new minified file. I do this to maintain an up-to-date underscore-min.js for benchmarks comparisons.

@jdalton thanks for the tip...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment