Holder.js for Rails
Provides Holder.js to render image placeholders entirely on the client side.
Installation
Add to your Gemfile:
gem 'holder_rails'
and run:
bundle install
Usage
Add to your JavaScript manifest file:
For versions less than 2.3.2, if you're using turbolinks
don't forget to run Holder
after page:change
event:
$(document).bind 'page:change', ->
Holder.run()
You can use holder_tag
helper in your views:
holder_tag 100
holder_tag '200x300'
holder_tag '200x300', 'Lorem ipsum'
holder_tag '200x300', 'Lorem ipsum', 'social'
holder_tag '500x800', 'Example text', 'gray', id: 'new', class: 'special'
holder_tag '500x800', 'Example text', 'gray', { id: 'new', class: 'special' }, { font: 'Helvetica' }
For more information, check out holder readme.
Versioning
holder_rails X.Y.Z == Holder.js X.Y.Z
License
Released under the BSD 2-clause license. See LICENSE.txt for details.