Git Product home page Git Product logo

holder_rails's Introduction

Holder.js for Rails

Build Status Gem Version

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:

//= require holder

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
# => <img data-src="holder.js/100x100?" src="" />

holder_tag '200x300'
# => <img data-src="holder.js/200x300?" src="" />

holder_tag '200x300', 'Lorem ipsum'
# => <img data-src="holder.js/200x300?text=Lorem ipsum" src="" />

holder_tag '200x300', 'Lorem ipsum', 'social'
# => <img data-src="holder.js/200x300?text=Lorem ipsum&amp;theme=social" src="" />

holder_tag '500x800', 'Example text', 'gray', id: 'new', class: 'special'
# => <img class="special" data-src="holder.js/500x800?text=Example text&amp;theme=gray" id="new" src="" />

holder_tag '500x800', 'Example text', 'gray', { id: 'new', class: 'special' }, { font: 'Helvetica' }
# => <img class="special" data-src="holder.js/500x800?font=Helvetica&amp;text=Example text&amp;theme=gray" id="new" src="" />

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.

holder_rails's People

Contributors

narkoz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.