{"id":195363,"date":"2015-02-09T09:42:04","date_gmt":"2015-02-09T16:42:04","guid":{"rendered":"http:\/\/css-tricks.com\/?p=195363"},"modified":"2015-02-10T08:38:52","modified_gmt":"2015-02-10T15:38:52","slug":"inline-svg-grunticon-fallback","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/inline-svg-grunticon-fallback\/","title":{"rendered":"Inline SVG with Grunticon Fallback"},"content":{"rendered":"

Grunticon 2 is out! It’s got a cool new website<\/a>. Grunticon is a damn fine tool for building an SVG icon system. The workflow is like:<\/p>\n

    \n
  1. Have a folder full of SVG icons<\/li>\n
  2. Run Grunticon on that folder, which produces everything you need<\/li>\n
  3. Put the bit of JavaScript in the <head><\/code><\/li>\n
  4. Use HTML like <div class=\"icon-image\"><\/div><\/code> where you want icons<\/li>\n
  5. Icons everywhere!<\/li>\n<\/ol>\n

    Grunticon 2 even has a method for injecting inline <svg><\/code>, so that you have all those advantages, like scripting, animating, CSS control, etc. You just add an attribute:<\/p>\n

    <div class=\"icon-burger alt\" data-grunticon-embed><\/div><\/code><\/pre>\n

    You’d be good using Grunticon just exactly how it is. It just is a bit of a different approach than the one I’ve been talking about a lot<\/a>, which uses an SVG sprite and inline <svg><use><\/use><\/svg><\/code>. <\/p>\n

    The way I show it, you start<\/em> with inline <svg><\/code> in the document where you want the icons, and handle fallbacks from there. The possible advantages to this are:<\/p>\n