-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove loadCSS and preload woff2 icon fonts #9976
Conversation
loadCSS was used as a polyfill for rel=preload but it seems we only used it on a single CSS file which did not help much. Changed the icon CSS to a blocking load and preload the woff2 variants which does work in modern browsers (Firefox currently needs the network.preload about:config setting but should gain proper support soon).
Codecov Report
@@ Coverage Diff @@
## master #9976 +/- ##
==========================================
- Coverage 42.27% 42.26% -0.01%
==========================================
Files 610 610
Lines 80364 80370 +6
==========================================
- Hits 33974 33971 -3
- Misses 42210 42221 +11
+ Partials 4180 4178 -2
Continue to review full report at Codecov.
|
@silverwind on master I'm getting in the console: "index.js:3000 A preload for 'https://localhost:3000/vendor/assets/octicons/octicons.woff2?ef21c39f0ca9b1b5116e5eb7ac5eabe6' is found, but is not used because the request credentials mode does not match. Consider taking a look at crossorigin attribute." |
Can't reproduce here it seems. Does this patch fix the issue? diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 5a27467f3..e3f48f774 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -86,11 +86,11 @@
<link rel="shortcut icon" href="{{StaticUrlPrefix}}/img/favicon.png" />
<link rel="mask-icon" href="{{StaticUrlPrefix}}/img/gitea-safari.svg" color="#609926">
<link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/assets/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/assets/octicons/octicons.min.css">
- <link rel="preload" as="font" href="{{StaticUrlPrefix}}/fomantic/themes/default/assets/fonts/icons.woff2" type="font/woff2">
- <link rel="preload" as="font" href="{{StaticUrlPrefix}}/fomantic/themes/default/assets/fonts/outline-icons.woff2" type="font/woff2">
- <link rel="preload" as="font" href="{{StaticUrlPrefix}}/vendor/assets/octicons/octicons.woff2?ef21c39f0ca9b1b5116e5eb7ac5eabe6" type="font/woff2">
+ <link rel="preload" as="font" href="{{StaticUrlPrefix}}/fomantic/themes/default/assets/fonts/icons.woff2" type="font/woff2" crossorigin="anonymous">
+ <link rel="preload" as="font" href="{{StaticUrlPrefix}}/fomantic/themes/default/assets/fonts/outline-icons.woff2" type="font/woff2" crossorigin="anonymous">
+ <link rel="preload" as="font" href="{{StaticUrlPrefix}}/vendor/assets/octicons/octicons.woff2?ef21c39f0ca9b1b5116e5eb7ac5eabe6" type="font/woff2" crossorigin="anonymous">
{{if .RequireSimpleMDE}}
<link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/simplemde/simplemde.min.css">
{{end}} |
|
loadCSS was used as a polyfill for rel=preload but it seems we only used it on a single CSS file which did not help much. Changed the icon CSS to a blocking load and preload the woff2 variants which does work in modern browsers (Firefox currently needs the network.preload about:config setting but should gain proper support soon).