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

Account for Svelte class bindings at the start of a line #4187

merged 2 commits into from Apr 30, 2021


Copy link

@bradlc bradlc commented Apr 26, 2021

Fixes #4181

This PR updates the Svelte class binding regular expression so that it catches instances at the start of a line.

Consider the following example:

  class:bg-red-500={current === 'foo'}
  Click me

Because the class extractor runs for each trimmed line separately, in this case it runs against class:bg-red-500={current === 'foo'}. The regular expression did not match the class binding because there is no whitespace before it.

The regular expression has been updated to look for either whitespace or the start of the string, which fixes the issue.

Copy link

codecov-commenter commented Apr 26, 2021

Codecov Report

Merging #4187 (ce1a0ee) into master (9b1e843) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4187   +/-   ##
  Coverage   86.84%   86.84%           
  Files         341      341           
  Lines        4836     4836           
  Branches      919      919           
  Hits         4200     4200           
  Misses        561      561           
  Partials       75       75           
Impacted Files Coverage Δ
jit/lib/expandTailwindAtRules.js 81.42% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b1e843...ce1a0ee. Read the comment docs.

@adamwathan adamwathan merged commit 44eddad into master Apr 30, 2021
2 checks passed
@adamwathan adamwathan deleted the bugfix-svelte-syntax branch Apr 30, 2021
Copy link

adamwathan commented Apr 30, 2021

Thanks @bradlc!

adamwathan pushed a commit that referenced this issue May 7, 2021
* add failing svelte syntax test case

* account for svelte class bindings at the start of a line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

3 participants