Shopify / Shopify/liquid

Using stylesheet tag with hyphens results in incorrect "tag was never closed" SyntaxError

Open
#1,655 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

Describe the bug

theme-check erroneously claims that stylesheet tags using hyphens are not closed.

Expected

{%- stylesheet -%}
    <CSS Rules>
{%- endstylesheet -%}

Should not result in any reported errors.

Actual

theme-check response:
'stylesheet' tag was never closedtheme-check[SyntaxError](https://github.com/Shopify/theme-check/blob/main/docs/checks/syntax_error.md)

Stack trace

none

Debugging information

  • OS Linux
  • theme-check 1.11.0

Additional context

Removing the hyphens like below fixes the error however:

{% stylesheet %}
    <CSS Rules>
{% endstylesheet %}

Even if there is a rule that stylesheet tags should not have the new-line preventing hyphens (not stated anywhere that I am aware of), the tag was never closed error would not be the correct classification.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue through theme-check using the hyphenated stylesheet and endstylesheet tags shown in the report, then trace how the parser handles those delimiters. Compare that path with the non-hyphenated example. Done means the hyphenated form produces no SyntaxError while the existing form remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.