jassa / lazyload-rails

jQuery Lazy Load for Rails image_tag helpers
MIT License
264 stars 46 forks source link

Configuration of placeholder only works with online image #15

Open alexandergantikow opened 6 years ago

alexandergantikow commented 6 years ago

Your proposed code for configuring the placeholder only works with an online source. If I use a local file I always get a route error. I'm not a rails pro by far... So tell me if I'm wrong :)

Paul-maire commented 6 years ago

Hello everyone, I know that the issue dates a little but I had the same problem recently. So I am not an expert on RoR but I noticed that once the assets are compiled they are not separated in different development folder (images, stylesheets, javascripts and others). So in the config/initializers/lazyload.rb file the configuration for a static file looks like this:

the gif I use as a custom file is named lazyloader.gif

Lazyload::Rails.configure do |config|
  config.placeholder = '/assets/lazyloader.gif' // --> real path are assets/images/lazyloader.gif
end

I hope it will serve to solve future issues.

PS: I'm French be indulgent with my english please ^^