Skip to content
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

Merged
merged 2 commits into from
Jan 25, 2020

Conversation

silverwind
Copy link
Member

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).

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-io
Copy link

codecov-io commented Jan 25, 2020

Codecov Report

Merging #9976 into master will decrease coverage by <.01%.
The diff coverage is 16.66%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
models/repo.go 49.66% <0%> (-0.17%) ⬇️
modules/util/sanitize.go 50% <100%> (+50%) ⬆️
modules/generate/generate.go 26% <0%> (-8%) ⬇️
services/pull/temp_repo.go 31.62% <0%> (-2.57%) ⬇️
modules/log/file.go 75.52% <0%> (-2.1%) ⬇️
modules/setting/setting.go 44.14% <0%> (-0.95%) ⬇️
services/pull/update.go 54.65% <0%> (+3.48%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68bd633...add8ee6. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 25, 2020
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 25, 2020
@zeripath zeripath added the topic/ui Change the appearance of the Gitea UI label Jan 25, 2020
@zeripath zeripath added this to the 1.12.0 milestone Jan 25, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 25, 2020
@lafriks lafriks merged commit 75a124b into go-gitea:master Jan 25, 2020
@silverwind silverwind deleted the remove-cssrelpreload branch January 25, 2020 19:31
@zeripath
Copy link
Contributor

@silverwind on master I'm getting in the console: "index.js:3000 A preload for 'http://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."

@silverwind
Copy link
Member Author

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}}

@silverwind
Copy link
Member Author

silverwind commented Jan 25, 2020

In which browser do you see those? Nevermind, reproduced.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants