Created
April 14, 2013 18:53
-
-
Save linssen/5383785 to your computer and use it in GitHub Desktop.
CoffeeScript to include web fonts from Google. See how it compiles below.
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
window.WebFontConfig = | |
google: | |
families: ['Droid+Serif:400,700,400italic:latin'] | |
wf = document.createElement('script') | |
wf.src = """#{if document.location.protocol == 'https' then 'https' else 'http'} | |
://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js""" | |
wf.type = "text/javascript" | |
wf.async = "true" | |
s = document.getElementsByTagName("script")[0] | |
s.parentNode.insertBefore(wf, s) |
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
(function() { | |
var s, wf; | |
window.WebFontConfig = { | |
google: { | |
families: ['Droid+Serif:400,700,400italic:latin'] | |
} | |
}; | |
wf = document.createElement('script'); | |
wf.src = "" + (document.location.protocol === 'https' ? 'https' : 'http') + "://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"; | |
wf.type = "text/javascript"; | |
wf.async = "true"; | |
s = document.getElementsByTagName("script")[0]; | |
s.parentNode.insertBefore(wf, s); | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment