Allow options to be passed to the javascript compressor #1500

wants to merge 1 commit into


None yet
5 participants

I need to pass the :except option into uglifier to protect the $super keyword in my javascript. I checked the API's of YUI and Closure, and all 3 support an options hash passed to the initializer. So it seems like another config key addresses the issue.


josevalim commented Jun 6, 2011

Maybe we could allow js_compressor to be a lambda and in such cases we just invoke it? Wouldn't it be better than adding a new config option? /cc @wycats

That seems reasonable to me, too.


neerajdotname commented Jun 8, 2011

@nathansobo what is so special about $super in JavaScript. And secondly why uglifier does not handle it correcly already? I'm just curious!

We built a layer on top of normal prototype-based inheritance that allows you to specify $super as the first parameter to a method and call it to invoke the method from the superclass. Prototype.js uses a similar technique as well. So the uglifier can't know we're planning on using the parameters in this way and we have to tell it. Our module system actually inspects the names of the function parameters when it's setting up our constructors.


neerajdotname commented Jun 8, 2011

Wow. That's hardcore. Thanks for the clarification.

jake3030 pushed a commit to jake3030/rails that referenced this pull request Jun 28, 2011

Implement #many? for NamedScope and AssociationCollection using #size [
…#1500 state:resolved]

Signed-off-by: Pratik Naik <>

So pull request thread hijacking aside, is this feature going anywhere? Is it in 3.2, maybe? I kind of need it, too.

@nathansobo any idea to do more work on this issue, as per @josevalim idea? Otherwise I'd like to close the issue, thanks.

I liked the lambda idea better than my pull request, but I don't have time to implement it right now. I'll go ahead and close it for now.

@nathansobo nathansobo closed this Apr 28, 2012

@nathansobo alright, thanks.

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