Skip to content

Commit 12aced1

Browse files
committed
Make google font not render blocking
1 parent 2523336 commit 12aced1

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

nuxt.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ module.exports = {
2929
{ hid: 'og:url', property: 'og:url', content: 'https://covid-worldwide.herokuapp.com' }
3030
],
3131
link: [
32-
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,700&display=swap' },
3332
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
3433
]
3534
},

pages/index.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const Overview = () => import('~/components/Overview')
3030
const Map = () => import('~/components/Map')
3131
3232
export default {
33+
head: {
34+
script: [
35+
{ src: 'font.js', body: true }
36+
]
37+
},
3338
components: {
3439
LazyHydrate,
3540
Latest,

static/font.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
WebFontConfig = {
2+
google: { families: [ 'Roboto:300,400,700' ] }
3+
}
4+
;(function(){
5+
var wf = document.createElement('script')
6+
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'
7+
wf.type = 'text/javascript'
8+
wf.async = 'true'
9+
var s = document.getElementsByTagName('script')[0]
10+
s.parentNode.insertBefore(wf, s)
11+
})()

0 commit comments

Comments
 (0)