Debugging errors in asset pipeline-compressed JS

Hi,

I have a situation where a big piece of CoffeeScript / JS work is
working
well uncompressed but not when compressed in the asset pipeline.

I’m wondering about strategory how to debug this, and currently if it’s
possible to pass options to Uglifier from Rails configuration files? For
example, I’d like to disable variable name changes and have only
whitespace
removed.

Compressing a file should not be contributing to errors - it’s likely
your production environment settings may have altered the environment
enough to produce these errors. Could you describe the problem in a
bit more detail so we can better guide you?

I have managed to isolate the application CS/JS from 3rd party libs,
which are temporarily sourced from dropbox, and run the app locally in
staging environment with manually precompiled assets.

The problem is simply that there’s a JS exception logged during runtime
that does not happen when I precompile with compress = false. The
message is “a.onb is not defined”, but I cannot find “a.onb” in the
source code.

What could be production/staging environment settings that might have
side effects?

I have realized that minified JS does not work because mangled code
broke
some metaprogramming from my codeveloper. So right now I’m looking for a
way to tell Uglifier to just strip whitespace, or ideally strip
whitespace
on certain files but mangle 3rd party libs.

On Apr 10, 2012, at 10:34 AM, Marko A. wrote:

I have realized that minified JS does not work because mangled code broke some
metaprogramming from my codeveloper. So right now I’m looking for a way to tell
Uglifier to just strip whitespace, or ideally strip whitespace on certain files
but mangle 3rd party libs.

Try running JSLint against the non-minified code, and fix any errors it
points out to you. Minification cannot break properly formatted
JavaScript.

Walter