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
merged 2 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion jit/lib/expandTailwindAtRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%]*[^<>"'`\s.(){}[\]#=%:]/
function getDefaultExtractor(fileExtension) {
return function (content) {
if (fileExtension === 'svelte') {
content = content.replace(/\sclass:/g, ' ')
content = content.replace(/(?:^|\s)class:/g, ' ')
}
let broadMatches = content.match(BROAD_MATCH_GLOBAL_REGEXP) || []
let innerMatches = content.match(INNER_MATCH_GLOBAL_REGEXP) || []
Expand Down
4 changes: 4 additions & 0 deletions jit/tests/svelte-syntax.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-shadow: 0 0 #0000;
}
.bg-red-500 {
--tw-bg-opacity: 1;
background-color: rgba(239, 68, 68, var(--tw-bg-opacity));
}
@media (min-width: 1024px) {
.lg\:hover\:bg-blue-500:hover {
--tw-bg-opacity: 1;
Expand Down
6 changes: 6 additions & 0 deletions jit/tests/svelte-syntax.test.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
</script>

<button class:lg:hover:bg-blue-500={current === 'foo'}>Click me</button>

<button
class:bg-red-500={current === 'foo'}
>
Click me
</button>