My .js files are compressed and the variables are distorted, but the function names are not distorted (the latest versions of Rails 3.2.8 and the latest uglify 1.3.0 gem are launched) on Heroku.
According to https://github.com/lautis/uglifier#usage, the "mangle" parameter is true by default. Below is my configuration.
From production.rb:
config.assets.compress = true config.assets.js_compressor = :uglifier
I also tried
config.assets.compress = true config.assets.js_compressor = Uglifier.new(:mangle => true, :toplevel => true, :copyright => true)
but without a noticeable difference.
As one of the commentators said, I tried to modify the contents of one of my .js files, but it didn't matter.
Example from the output of a compressed pre-compiled .js file on Heroku:
show_slideout_notification=function(){jQuery(".slideout_notification").slideDown();var e=$(".slideout_notification .countdown
It looks like the variable names are distorted, but the function names are not.
Any ideas why function names are not distorted? Or this is an undesirable behavior, since then it will be difficult to call functions from my Rails / js code (i.e. javascript onclick events). Or will onclick calls be redirected to a garbled name if function names are garbled?
Thanks: -)
source share