Requiring gem in Ruby on Rails - OilyPNG vs ChunkyPNG

270 views Asked by At

I am currently using ChunkyPNG, but I want to give OilyPNG a try. I have tried using it in a simple ruby script and the performance is much better. I basically install both gems in the Gemfile and require 'oily_png' in my script.

However, in my RoR app, I fail to see how to require 'oily_png'. I am currently not requiring chunky_png anywhere, but in the docs is said that I need to require 'oily_png'. Where would I do that?

Thanks!

1

There are 1 answers

0
Nobita On BEST ANSWER

Just avoid requiring ChunkyPNG on the Gemfile. Something like this:

gem 'chunky_png', :require => false

So, the ChunkyPNG gem will be installed, but when Rails tells Bundler to require all the gems, this one won't be required, but the OilyPNG will be.