From 98aa41222e74342a2f3294a8963462e5dfd1844b Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 8 Sep 2017 12:40:06 -0400 Subject: [PATCH] moved roboto link tag from CSS import to prefetched link tag, re: nodebb/nodebb#5733 --- less/style.less | 2 -- library.js | 10 ++++++++++ plugin.json | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/less/style.less b/less/style.less index 55b6158..b068961 100644 --- a/less/style.less +++ b/less/style.less @@ -1,5 +1,3 @@ -@import url(https://fonts.googleapis.com/css?family=Roboto:300,400,500,700); - html { overflow-y: scroll; min-height: 100%; diff --git a/library.js b/library.js index 1280951..2a45c43 100644 --- a/library.js +++ b/library.js @@ -117,4 +117,14 @@ library.addUserToTopic = function(data, callback) { } }; +library.getLinkTags = function (data, callback) { + data.links.push({ + rel: 'prefetch stylesheet', + type: '', + href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700', + }); + + callback(null, data); +}; + module.exports = library; diff --git a/plugin.json b/plugin.json index 342429b..808a9d2 100644 --- a/plugin.json +++ b/plugin.json @@ -7,7 +7,8 @@ { "hook": "filter:config.get", "method": "getThemeConfig" }, { "hook": "static:app.load", "method": "init" }, { "hook": "filter:admin.header.build", "method": "addAdminNavigation" }, - { "hook": "filter:topic.build", "method": "addUserToTopic" } + { "hook": "filter:topic.build", "method": "addUserToTopic" }, + { "hook": "filter:meta.getLinkTags", "method": "getLinkTags"} ], "scripts": [ "lib/persona.js",