Created
September 5, 2011 21:00
-
-
Save philmander/1195905 to your computer and use it in GitHub Desktop.
Data URIs and automation with CSSEmbed and Ant 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function() { | |
function addStylesheet(dataUriHref, fallbackHref) { | |
var img = new Image(); | |
img.onload = img.onerror = function() { | |
var link = window.document.createElement("link"); | |
link.type = "text/css"; | |
link.rel = "stylesheet"; | |
link.href = this.width !== 1 ? fallbackHref : dataUriHref; | |
var head = document.getElementsByTagName("head")[0] || document.documentElement; | |
head.insertBefore(link, head.firstChild); | |
}; | |
img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; | |
} | |
addStylesheet("/css/site-datauri.css", "/css/site-mhtml.css"); | |
})(); | |
</script> | |
<noscript> | |
<link type="text/css" rel="stylesheet" href="/css/site.css" /> | |
</noscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment