mustangostang / grumpy

SVG Data URIs, done right

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SVG Data URIs, done right

JS in head:

//= require grumpy
* todo: grumpy_javascript_tag helper

SASS mixin (with Compass):

 @mixin svg($file) {
   background-image: inline-image("#{$file}.svg", image/svg\+xml);
   html.no-inlinesvg & {
     background-image: image-url("no-svg/#{$file}.png");
   }
 }

CSS usage example:

.logo {
  @include svg("logo");
  background-repeat: no-repeat;
  display: block;
  width: 250px; height: 100px;
  background-size: 250px;
}

Directory structure:

- images:
  - no-svg:
    logo.png
  logo.svg

About

SVG Data URIs, done right

License:MIT License


Languages

Language:Ruby 57.4%Language:JavaScript 29.7%Language:CSS 12.9%