8000 GitHub - fadimezhan/retinajs-rails
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fadimezhan/retinajs-rails

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

retinajs-rails

Integrates Retina.js with the rails asset pipeline.

Retina.js is an awesome and simple plugin for rendering retina images for displays that support this.

Installation

Add this line to your application's Gemfile:

gem "retinajs-rails", "~> 2.1.3"

And then execute:

$ bundle

Usage

To import the js plugin, add the following line to your application.js:

//= require retina

Image helper

Now you will be able to render retina images by using the image_tag_with_at2x helper. Example:

# Replace:
image_tag "logo.png"

# With:
image_tag_with_at2x "logo.png"

This will output the HTML similar to:

<img data-rjs="/assets/logo@2x.png" src="/assets/l
5D37
ogo.png">

SCSS mixin

If you'd like to use the SCSS mixin, you need to import retina.scss, add the following line to your application.scss:

@import "retina"

Now you're able to use the .at2x mixin in your stylesheets.

For example:

.logo {
  @include retina('logo.png');
}

will compile to something that resembles:

.logo {
  background-image: url('logo.png');
}

@media all and (-webkit-min-device-pixel-ratio: 1.5) {
  .logo {
    background-image: url('logo@2x.png');
  }
}

For more information about Retina.js, see: http://imulus.github.io/retinajs/

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 83.4%
  • Ruby 16.6%
0