Skip to content

Commit

Permalink
refactor: Defer some non critical css
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitcheljager committed Feb 6, 2025
1 parent f830248 commit a99a7ba
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 15 deletions.
4 changes: 4 additions & 0 deletions app/javascript/entrypoints/deferred.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import "@scss/variables",
"@scss/mixins";

@import "../scss/deferred/*";
File renamed without changes.
File renamed without changes.
15 changes: 0 additions & 15 deletions app/javascript/scss/elements/_progress.scss

This file was deleted.

File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
onload="this.onload=null;this.rel='stylesheet'" /> <!-- https://web.dev/defer-non-critical-css/#optimize -->
<noscript><%= vite_stylesheet_tag "fonts.scss" %></noscript>

<link rel="preload"
href="<%= vite_asset_url "deferred.scss" %>"
as="style"
onload="this.onload=null;this.rel='stylesheet'" /> <!-- https://web.dev/defer-non-critical-css/#optimize -->
<noscript><%= vite_stylesheet_tag "deferred.scss" %></noscript>

<!-- Prevent flashbangs -->
<style>
body {
Expand Down

0 comments on commit a99a7ba

Please sign in to comment.