Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asynchronously loading the webfont + caching it #69

Closed
wants to merge 1 commit into from
Closed

asynchronously loading the webfont + caching it #69

wants to merge 1 commit into from

Conversation

ddprrt
Copy link

@ddprrt ddprrt commented Aug 31, 2015

This is related to #57:

  • webfont.css contains "Source Sans Pro" in weights 300, 400, 600 and 700. I removed the italic styles, mainly because they aren't used anywhere on the site.
  • footer.hbs contains a JavaScript, ajax-ing webfont.css and putting the contents into localStorage.
  • html-head.hbs loads CSS from localStorage and puts it as the first styles, practically inlining the webfonts.
  • Removing prism-tomorrow.css and putting it at the end of layouts/about.hbs -- this might be not valid, but browsers behave friendly: They load it as the last resource, non-blocking.

}
});
xhr.open('get', '/static/fonts/webfont.css');
xhr.send();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw.: yes, we load the webfonts.css every time, and also update the cache every time. The user still gets a fast experience, the webfonts.css will be cached, but in case of new and different fonts, we still get an update.

@silverwind
Copy link
Contributor

Guess this is kind of obsolete now with aa4b373.

@silverwind silverwind closed this Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants