Skip to content

Commit

Permalink
fix fontface
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikeng committed Sep 18, 2019
1 parent 5b81b69 commit 2172fd9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/inlineJs/load-fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ var FontA = new FontFaceObserver("Roboto Condensed");
var FontB = new FontFaceObserver("Cabin");

Promise.all([FontA.load(), FontB.load()]).then(function () {
document.documentElement.className += " fonts-loaded FO ";
document.documentElement.className += "fonts-loaded";
});
1 change: 1 addition & 0 deletions templates/_layouts/_partials/font-face-observer.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<style>
{{ craft.twigpack.includeFile("@webroot/dist/css/webfonts.css") }}
</style>
{% set fontsLoaded = getCookie('fonts-loaded') %}
{% if fontsLoaded and fontsLoaded == assetHash %}
{% else %}
<script>
Expand Down
4 changes: 2 additions & 2 deletions templates/_layouts/_partials/html-tag.twig
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% if not craft.app.config.general.devMode %}
{% set fontsLoaded = getCookie('fonts-loaded') %}
{% if fontsLoaded and fontsLoaded == assetHash %}
<html class="fonts-loaded HTML " lang="{{ craft.app.language |slice(0,2) }}"
<html class="fonts-loaded" lang="{{ craft.app.language |slice(0,2) }}"
prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
{% else %}
<html lang="{{ craft.app.language |slice(0,2) }}"
prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
{% endif %}
{% else %}
<html class="fonts-loaded dev" lang="{{ craft.app.language |slice(0,2) }}"
<html class="fonts-loaded" lang="{{ craft.app.language |slice(0,2) }}"
prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
{% endif %}

0 comments on commit 2172fd9

Please sign in to comment.