Created
May 7, 2011 15:56
-
-
Save naneau/960600 to your computer and use it in GitHub Desktop.
Load google web fonts, in CoffeeScript! :)
This file contains hidden or 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
# Export Google WebFont Config | |
window.WebFontConfig = | |
# Load some fonts from google | |
google: | |
families: ['Inconsolata', 'Pacifico', 'Droid Sans', 'Droid Serif'] | |
# ... you can do something here if you'd like | |
active: () -> | |
# Create script tag matching protocol | |
s = document.createElement 'script' | |
s.src = "#{if document.location.protocol is 'https:' then 'https' else 'http'}://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js" | |
s.type = 'text/javascript' | |
s.async = 'true' | |
# Insert it before the first script tag | |
s0 = (document.getElementsByTagName 'script')[0] | |
s0.parentNode.insertBefore s, s0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment