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

Defer non-critical CSS to prevent flash of unstyled content #1246

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/* Leaflet */
@import url("https://cdn.skypack.dev/[email protected]/dist/leaflet.css");
@import url("https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.fullscreen.css");

/* OpenLayers */
@import url("https://cdn.skypack.dev/[email protected]/ol.css");

/* GeoBlacklight (compiled locally by cssbundling-rails) */
@import url("geoblacklight.css");

Expand Down
12 changes: 9 additions & 3 deletions app/views/layouts/blacklight/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());

const config = {};
<% if Settings.ANALYTICS_DEBUG %>
config.debug_mode = true
<% end %>

gtag('config', 'G-ZL7MQNBFW9', config)
</script>

Expand Down Expand Up @@ -65,5 +65,11 @@

<%= render partial: 'shared/footer' %>
<%= render partial: 'shared/modal' %>

<% # Non-render blocking css should be outside of the head %>
<%= stylesheet_link_tag "https://cdn.skypack.dev/[email protected]/dist/leaflet.css" %>
<%= stylesheet_link_tag "https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.fullscreen.css" %>
<%= stylesheet_link_tag "https://cdn.skypack.dev/[email protected]/ol.css" %>

</body>
<% end %>
<% end %>