Skip to content
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
- Fix class detection in Slim templates with attached attributes and ID ([#14019](https://github.com/tailwindlabs/tailwindcss/pull/14019))

## [3.4.6] - 2024-07-16

Expand Down
3 changes: 3 additions & 0 deletions src/lib/defaultExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ function* buildRegExps(context) {
utility,
])
}

// 5. Inner matches
yield /[^<>"'`\s.(){}[\]#=%$][^<>"'`\s(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g
}

// We want to capture any "special" characters
Expand Down
20 changes: 20 additions & 0 deletions tests/default-extractor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,26 @@ test('classes in slim templates starting with number', async () => {
expect(extractions).toContain('2xl:bg-red-300')
})

test('classes in slim templates with attributes added', () => {
let extractions = defaultExtractor(`
.ml-auto[
data-value='foo'
]
Foo bar
.mr-auto[data-value='foo']
Foo bar
.mt-auto#omg
Foo bar
#omg.mb-auto
Foo bar
`)

expect(extractions).toContain(`ml-auto`)
expect(extractions).toContain(`mr-auto`)
expect(extractions).toContain(`mt-auto`)
expect(extractions).toContain(`mb-auto`)
})

test("classes with fractional numeric values don't also generate the whole number utility", async () => {
const extractions = defaultExtractor(`
<div class="px-1.5 py-2.75">Hello world!</div>
Expand Down