Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions layouts/about.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
{{> footer }}
</body>
</html>
<link rel="stylesheet" href="/static/css/prism-tomorrow.css" media="all">
20 changes: 20 additions & 0 deletions layouts/partials/footer.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,23 @@
</div>
</div>
</footer>
<script type="text/javascript">
(function(d) {
try {
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', function() {
if(this.responseText) {
addStyle(this.responseText);
window.localStorage.fonts_css_cache = this.responseText;
}
});
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.

} catch(e) {
var c = d.createElement('link'), sc = d.getElementsByTagName("script")[0];
c.href = '//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300italic,400,400italic,600,600italic,700,700italic';
c.rel = 'stylesheet';
sc.parentNode.insertBefore(c,sc);
}
})(document);
</script>
25 changes: 21 additions & 4 deletions layouts/partials/html-head.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,38 @@
<meta charset="utf-8">
<title>{{#if title}}{{ title }} | {{/if}}{{ site.title }}</title>

<link rel="dns-prefetch" href="http://fonts.googleapis.com">
<link rel="dns-prefetch" href="http://fonts.gstatic.com">
<link rel="dns-prefetch" href="http://www.google-analytics.com">
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300italic,400,400italic,600,600italic,700,700italic' rel='stylesheet' type='text/css'>

<meta name="author" content="{{ site.author }}">
<meta name="robots" content="{{#if robots}}{{ robots }}{{else}}index, follow{{/if}}">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script type="text/javascript">
var addStyle = (function(d) {
return function(style) {
if(!d.querySelector('#fontcache')) {
var c = d.createElement('style'), sc = d.getElementsByTagName("script")[0];
c.innerHTML = style;
c.id = 'fontcache';
sc.parentNode.insertBefore(c,sc);
}
}
})(document);
(function(d,w,s) {
if('querySelector' in d && 'localStorage' in w && s.getItem('fonts_css_cache') !== null) {
addStyle(s.fonts_css_cache);
}
})(document, window, window.localStorage);
</script>
<noscript>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300italic,400,400italic,600,600italic,700,700italic">
</noscript>

{{!-- <link rel="apple-touch-icon" href="/static/apple-touch-icon.png"> --}}
{{!-- <link rel="icon" href="/static/apple-touch-icon.png"> --}}

<link rel="canonical" href="{{ canonical }}">
<link rel="alternate" href="/{{site.locale}}/blog.xml" title="Node.js Blog" type="application/rss+xml">
<link rel="alternate" href="/{{site.locale}}/tsc-minutes.xml" title="Node.js TSC meeting minutes" type="application/rss+xml">
<link rel="stylesheet" href="/{{site.locale}}/styles.css" media="all">
<link rel="stylesheet" href="/static/css/prism-tomorrow.css" media="all">
</head>
24 changes: 24 additions & 0 deletions static/fonts/webfont.css

Large diffs are not rendered by default.