Skip to content

Instantly share code, notes, and snippets.

@linssen
Created April 14, 2013 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linssen/5383785 to your computer and use it in GitHub Desktop.
Save linssen/5383785 to your computer and use it in GitHub Desktop.
CoffeeScript to include web fonts from Google. See how it compiles below.
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)
(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