Disable Asset Minification in Rails Production

后端 未结 9 1889
Happy的楠姐
Happy的楠姐 2020-12-04 17:52

In order to debug javascript in my heroku production environment, I need to disable asset compression (or at least compression of javascript). I tried config.assets.c

9条回答
  •  有刺的猬
    2020-12-04 18:24

    I also need to debug my js so I tried ncherro's solution. The problem was that it would still throw

    rake aborted! uninitialized constant NoCompression

    So I just put the NoCompression class in the production.rb file

        # Compress JavaScripts and CSS
        class NoCompression
             def compress(string)
                 # do nothing
                 string
             end
         end
    
         config.assets.compress = true
         config.assets.js_compressor = NoCompression.new
         config.assets.css_compressor = NoCompression.new
    

提交回复
热议问题