shopify-packer icon indicating copy to clipboard operation
shopify-packer copied to clipboard

[BUG] Style-tags.liquid not loading product.css

Open qedric opened this issue 3 years ago • 0 comments

Describe the bug

I just upgraded to version 2.2 of shopify packer (from version 2.1.9 I think) Somehow the upgrade has caused the following issue:

I have a product template, and also a product.bundle template. The styles for the bundle tempate are loading fine:

 {%- if template == 'product.bundle' -%}
<link type="text/css" href="{{ '[email protected]' | asset_url }}" rel="stylesheet">
{%- else -%}
<link rel="prefetch" href="{{ '[email protected]' | asset_url }}" as="style">
{%- endif -%}

however, there is no if statement for just the product bundle alone, and when I look in the /assets folder I see that there is no template.product.css, only the [email protected] shown above.

My templates/product.js and templates/product.bundle.js are almost identical, and both import the same .scss file.

I found another curious thing. When I looked at my old dist folder from previous version of shopify packer, I see the following:

{%- if template == 'page.testimonials' -%}
<link type="text/css" href="{{ 'template.page.testimonials.css' | asset_url }}" rel="stylesheet">
{%- else -%}
<link rel="prefetch" href="{{ 'template.page.testimonials.css' | asset_url }}" as="style">
{%- endif -%} 
**<link type="text/css" href="{{ '[email protected]' | asset_url }}" rel="stylesheet">**
{%- if layout == 'theme' -%}
<link type="text/css" href="{{ 'layout.theme.styleLiquid.css' | asset_url }}" rel="stylesheet">
{%- else -%}
<link rel="prefetch" href="{{ 'layout.theme.styleLiquid.css' | asset_url }}" as="style">
{%- endif -%}

So before it was working, but ONLY because the product style was being loaded on EVERY page!!

Can you tell me what's going wrong, what I need to change? Thanks!

Expected behavior The css for the default product template should load. it should be wrapped in a liquid condition .

Screenshots If applicable, add screenshots to help explain your problem.

System (please complete the following information):

  • OS: Windows 10
  • Browser [chrome]

Packer (please complete the following information):

  • Version [e.g. 2.2.0

Theme (please complete the following information):

  • custom

qedric avatar Jul 06 '21 16:07 qedric