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

TH-74: All themes > Performance > Eliminate render-blocking resources #31

Merged
merged 6 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 4 additions & 1 deletion themes/aura/sections/main-navbar.liquid
eihabkhan1 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already preconnect to google fonts in head-config which is called before main-navbar

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ 'navbar.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'navbar.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'navbar.css' | asset_url }}"></noscript>

{% style %}
:root{
Expand Down Expand Up @@ -40,6 +41,8 @@
{% if section.settings.toggle_navbar != true %}
<header class='yc-header {%if section.settings.navbar_always_on_top%} nav-fixed {%endif%}'>
{%- if section.settings.navbar_font_family -%}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href='https://fonts.googleapis.com/css2?family={{ section.settings.navbar_font_family }}:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap'
rel='stylesheet'
Expand Down
3 changes: 2 additions & 1 deletion themes/aura/sections/notice-bar.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ 'notice-bar.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'notice-bar.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'notice-bar.css' | asset_url }}"></noscript>

{% style %}
:root {
Expand Down
3 changes: 2 additions & 1 deletion themes/aura/sections/product-reviews.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ 'notice-bar.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'notice-bar.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'notice-bar.css' | asset_url }}"></noscript>

{%- assign selected_product = section.settings.product %}

Expand Down
7 changes: 5 additions & 2 deletions themes/aura/snippets/head-config.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@
const ratings = "{{ 'reviews.ratings' | t }}";
{% endjavascript %}

{{ 'main.css' | asset_url | stylesheet_tag }}
{{ 'utils.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'main.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'main.css' | asset_url }}"></noscript>

<link rel="preload" href="{{ 'utils.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'utils.css' | asset_url }}"></noscript>

{% assign store_title = store.title | default: store.name %}

Expand Down
3 changes: 2 additions & 1 deletion themes/harmony/sections/main-navbar.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ 'navbar.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'navbar.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'navbar.css' | asset_url }}"></noscript>

{% style %}
:root{
Expand Down
3 changes: 2 additions & 1 deletion themes/harmony/sections/notice-bar.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ 'notice-bar.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'notice-bar.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'notice-bar.css' | asset_url }}"></noscript>

{% style %}
:root {
Expand Down
3 changes: 2 additions & 1 deletion themes/harmony/sections/product-reviews.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ 'notice-bar.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'notice-bar.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'notice-bar.css' | asset_url }}"></noscript>

{%- assign selected_product = section.settings.product %}

Expand Down
7 changes: 5 additions & 2 deletions themes/harmony/snippets/head-config.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@
const ratings = "{{ 'reviews.ratings' | t }}";
{% endjavascript %}

{{ 'main.css' | asset_url | stylesheet_tag }}
{{ 'utils.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'main.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'main.css' | asset_url }}"></noscript>

<link rel="preload" href="{{ 'utils.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'utils.css' | asset_url }}"></noscript>

{% assign store_title = store.title | default: store.name %}

Expand Down
6 changes: 5 additions & 1 deletion themes/meraki/sections/main-navbar.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{ 'navbar.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'navbar.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'navbar.css' | asset_url }}"></noscript>


{% style %}
:root {
Expand Down Expand Up @@ -36,6 +38,8 @@
{% if section.settings.toggle_navbar != true %}
<header class='yc-header {%if section.settings.navbar_always_on_top%} nav-fixed {%endif%}'>
{%- if section.settings.navbar_font_family -%}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href='https://fonts.googleapis.com/css2?family={{ section.settings.navbar_font_family }}:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap'
rel='stylesheet'
Expand Down
3 changes: 2 additions & 1 deletion themes/meraki/sections/notice-bar.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ 'notice-bar.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'notice-bar.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'notice-bar.css' | asset_url }}"></noscript>

{% style %}
:root {
Expand Down
3 changes: 2 additions & 1 deletion themes/meraki/sections/product-reviews.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ 'notice-bar.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'notice-bar.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'notice-bar.css' | asset_url }}"></noscript>

{%- assign selected_product = section.settings.product %}

Expand Down
7 changes: 5 additions & 2 deletions themes/meraki/snippets/head-config.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@
const ratings = "{{ 'reviews.ratings' | t }}";
{% endjavascript %}

{{ 'main.css' | asset_url | stylesheet_tag }}
{{ 'utils.css' | asset_url | stylesheet_tag }}
<link rel="preload" href="{{ 'main.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'main.css' | asset_url }}"></noscript>

<link rel="preload" href="{{ 'utils.css' | asset_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ 'utils.css' | asset_url }}"></noscript>

{% assign store_title = store.title | default: store.name %}

Expand Down