Using Typekit with the new Google Font API
I was working with the new Google Font API and found that their documentation for using it with Typekit was a little off. After scratching my head a bit when it didn’t work, I found the proper code on TypeKit’s WebFont Loader github page.
On a side note, since I hadn’t used Typekit before I wasn’t sure what myKitId referred to. Turns out that myKitId is your Typekit Kit ID which can be found on Typekit in your Kit Editor under Embed Code.
Rather than:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"></script>
<script type="text/javascript">
WebFont.load({
typekit: 'myKitId'
});
</script>
It should be:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"></script>
<script type="text/javascript">
WebFont.load({
typekit: {
id: 'myKitId'
}
});
</script>