Skip to content

Instantly share code, notes, and snippets.

@ivarvong
Created January 23, 2014 14:03
Show Gist options
  • Save ivarvong/8578883 to your computer and use it in GitHub Desktop.
Save ivarvong/8578883 to your computer and use it in GitHub Desktop.
This is how I'm using TypeKit in the Rails asset pipeline. Replace your kit id, of course.
(function() {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '//use.typekit.net/XXXXXXX.js';
var callback = function() {
try {
Typekit.load();
} catch(e) {
// report error
}
}
script.onreadystatechange = callback;
script.onload = callback;
head.appendChild(script);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment