Read more

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

Tobias Kraze
September 26, 2012Software engineer at makandra GmbH

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

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

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
    
Posted by Tobias Kraze to makandra dev (2012-09-26 18:36)