Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added asset-pipeline support for rails

  • Loading branch information...
commit 66905a1c8563868a12e42ff2572be2545d3e1ea8 1 parent dc50484
Phil LaPier authored
Showing with 16 additions and 5 deletions.
  1. +16 −5 app/assets/stylesheets/addons/_retina-image.scss
View
21 app/assets/stylesheets/addons/_retina-image.scss
@@ -1,5 +1,5 @@
-@mixin retina-image($filename, $image-width, $image-height, $extension: ".png", $retina-filename: null) {
- background-image: url($filename + $extension);
+@mixin retina-image($filename, $image-width, $image-height, $extension: png, $retina-filename: null, $asset-pipeline: false) {
+ background-image: url($filename + "." + $extension);
height: $image-height;
width: $image-width;
@@ -9,11 +9,22 @@
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
- @if $retina-filename {
- background-image: url($retina-filename + "@2x" + $extension);
+ @if $asset-pipeline {
+ @if $retina-filename {
+ background-image: image_url($retina-filename + "@2x" + "." + $extension);
+ }
+ @else {
+ background-image: image_url($filename + "@2x" + "." + $extension);
+ }
}
+
@else {
- background-image: url($filename + "@2x" + $extension);
+ @if $retina-filename {
+ background-image: url($retina-filename + "@2x" + "." + $extension);
+ }
+ @else {
+ background-image: url($filename + "@2x" + "." + $extension);
+ }
}
background-size: $image-width $image-height;
Please sign in to comment.
Something went wrong with that request. Please try again.