1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-30 05:31:56 +02:00

css-only Typekit loading

This commit is contained in:
Matthias Kretschmann 2017-12-05 22:50:27 +01:00
parent 0eb35a4610
commit df99f418f4
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 4 additions and 22 deletions

View File

@ -32,6 +32,7 @@ body
word-break: break-word
text-rendering: optimizeLegibility
font-display: swap
// Controversial! But prevents text flickering in
// Safari/Firefox when animations are running
-webkit-font-smoothing: antialiased
@ -40,9 +41,6 @@ body
letter-spacing: -.01em
.wf-active &
letter-spacing: normal
p,
ul,
ol
@ -72,10 +70,6 @@ h1, h2, h3, h4, h5, h6,
font-weight: 500
letter-spacing: -.04em
.wf-active &
font-weight: $headings-font-weight
letter-spacing: normal
h1, .h1,
h2, .h2
margin-top: ($spacer*2)

View File

@ -63,21 +63,9 @@
<meta name="robots" content="noindex,nofollow">
{% endif %}
<!--
TypeKit
Improved snippet from https://blog.5apps.com/2014/02/21/using-typekit-the-right-way-with-an-improved-loading-script.html
-->
<script>
(function(d) {
var tkTimeout=3000;
if(window.sessionStorage){if(sessionStorage.getItem('useTypekit')==='false'){tkTimeout=0;}}
var config = {
kitId: 'msu4qap',
scriptTimeout: tkTimeout
},
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+"wf-inactive";if(window.sessionStorage){sessionStorage.setItem("useTypekit","false")}},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+="wf-loading";tk.src='//use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
})(document);
</script>
<!-- TypeKit -->
<link rel="preload" href="https://use.typekit.net/msu4qap.css" as="style" crossorigin>
<link rel="stylesheet" href="https://use.typekit.net/msu4qap.css">
<!-- Canonical URL -->
<link rel="canonical" href="{{ site.url}}{{ page.url | replace:'index.html','' }}">