Commit bcc330ff authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '337095-loading-hints' into 'master'

Unified preloading stylesheets

See merge request gitlab-org/gitlab!67045
parents dd9e040d a712e481
......@@ -32,10 +32,6 @@
- if page_canonical_link
%link{ rel: 'canonical', href: page_canonical_link }
- if user_application_theme == 'gl-dark'
= preload_link_tag(path_to_stylesheet('application_utilities_dark'))
- else
= preload_link_tag(path_to_stylesheet('application_utilities'))
= yield :prefetch_asset_tags
= favicon_link_tag favicon, id: 'favicon', data: { original_href: favicon }, type: 'image/png'
......
= cache_if(Feature.enabled?(:cached_loading_hints, current_user), [ActionController::Base.asset_host, user_application_theme, user_color_scheme], expires_in: 1.minute) do
- css_crossorigin = ActionController::Base.asset_host ? 'anonymous' : nil
- if ActionController::Base.asset_host
%link{ rel: 'dns-prefetch', href: ActionController::Base.asset_host }
%link{ rel: 'preconnect', href: ActionController::Base.asset_host, crossorigin: '' }
- if user_application_theme == 'gl-dark'
%link{ { rel: 'preload', href: stylesheet_url('application_dark'), as: 'style' }, ActionController::Base.asset_host ? { crossorigin: 'anonymous' } : {} }
= preload_link_tag(path_to_stylesheet('application_utilities_dark'), crossorigin: css_crossorigin)
= preload_link_tag(path_to_stylesheet('application_dark'), crossorigin: css_crossorigin)
- else
%link{ { rel: 'preload', href: stylesheet_url('application'), as: 'style' }, ActionController::Base.asset_host ? { crossorigin: 'anonymous' } : {} }
%link{ { rel: 'preload', href: stylesheet_url("highlight/themes/#{user_color_scheme}"), as: 'style' }, ActionController::Base.asset_host ? { crossorigin: 'anonymous' } : {} }
= preload_link_tag(path_to_stylesheet('application_utilities'), crossorigin: css_crossorigin)
= preload_link_tag(path_to_stylesheet('application'), crossorigin: css_crossorigin)
= preload_link_tag(path_to_stylesheet("highlight/themes/#{user_color_scheme}"), crossorigin: css_crossorigin)
- if Gitlab::Tracking.enabled? && Gitlab::CurrentSettings.snowplow_collector_hostname
%link{ rel: 'preconnect', href: Gitlab::CurrentSettings.snowplow_collector_hostname, crossorigin: '' }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment