mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 01:33:45 +08:00
cfde4419f5
This commit adds preload links for core/plugin/theme CSS stylesheets in the head. Preload links are non-blocking and run in parallel. This means that they should have already been downloaded by the time we use the actual stylesheets (in the <body> tag). Google is currently complaining about this here and this PR will address that warning. This commit will also fix an issue in the splash screen where it sometimes doesn't respect the theme colors - causing a slightly jarring experience on dark themes. Note that I opted not to add new specs because the underlying work required already has a lot of coverage. The new methods only change the output HTML so we can chuck that in the document <head> This change also means that we can make all the stylesheets non-render blocking, but that will follow in a separate commit.
24 lines
810 B
Plaintext
24 lines
810 B
Plaintext
<%= discourse_preload_color_scheme_stylesheets %>
|
|
|
|
<%- if rtl? %>
|
|
<%= discourse_stylesheet_preload_tag(mobile_view? ? :mobile_rtl : :desktop_rtl) %>
|
|
<%- else %>
|
|
<%= discourse_stylesheet_preload_tag(mobile_view? ? :mobile : :desktop) %>
|
|
<%- end %>
|
|
|
|
<%- if staff? %>
|
|
<%= discourse_stylesheet_preload_tag(:admin) %>
|
|
<%- end %>
|
|
|
|
<%- if admin? %>
|
|
<%= discourse_stylesheet_preload_tag(:wizard) %>
|
|
<%- end %>
|
|
|
|
<%- Discourse.find_plugin_css_assets(include_official: allow_plugins?, include_unofficial: allow_third_party_plugins?, mobile_view: mobile_view?, desktop_view: !mobile_view?, request: request).each do |file| %>
|
|
<%= discourse_stylesheet_preload_tag(file) %>
|
|
<%- end %>
|
|
|
|
<%- if theme_id.present? %>
|
|
<%= discourse_stylesheet_preload_tag(mobile_view? ? :mobile_theme : :desktop_theme) %>
|
|
<%- end %>
|