Asset pipeline may break Javascript for IE (but only on production)

Updated . Posted . Visible to the public.

If some of your JavaScripts fail on Internet Explorer, but only in staging or production environments, chances are that JavaScript compression is the culprit.

By default, Rails 3.2 compresses JavaScript with UglifyJS. I have seen a few cases where this actually breaks functioning JavaScript on IE (one example is the CKEditor Show archive.org snapshot ).

I fixed this by switching to Yahoo's YUI Compressor Show archive.org snapshot .

To do this, do the following:

  • replace the uglifier gem with the yui-compressor gem in your Gemfile

  • add this line to your application.rb:

    config.assets.js_compressor = :yui
    
Tobias Kraze
Last edit
Dominik Schöler
Keywords
CKEditor
License
Source code in this card is licensed under the MIT License.
Posted by Tobias Kraze to makandra dev (2012-09-26 16:36)