Skip to content

Instantly share code, notes, and snippets.

View carwin's full-sized avatar
🍔
cheeseburger

Carwin Young carwin

🍔
cheeseburger
  • Missouri
View GitHub Profile
@aradnom
aradnom / grunticon-svg-inliner.js
Last active August 29, 2015 14:03
Grunticon SVG inliner - automatically replace grunticon-produced SVG backgrounds with inline SVGs. Framework-agnostic.
(function () {
var waiting = setInterval( function () {
var nodes = document.querySelectorAll('.inline-svg[class^="icon-"], .inline-svg[class*=" icon-"]');
for ( var i = 0; i < nodes.length; i++ ) {
// Pull the background in (this should always be a background image)
var background = document.defaultView.getComputedStyle(nodes[i])['background-image'];
// Check to see if an element has a background - if so, background has loaded
if (background && background !== 'none') {
if ( waiting ) clearInterval( waiting );