Skip to content

Commit 9032ff3

Browse files
committed
Improve support for purging Haml even more
1 parent cdef9c8 commit 9032ff3

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

__tests__/fixtures/purge-example.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@
3434
.flow-root
3535
.text-green-700.bg-green-100
3636
.text-left= content
37-
%samp= output
37+
%samp.font-mono{:data-foo => "bar"}= output
38+
.col-span-4[aria-hidden=true]
39+
.tracking-tight#headline

__tests__/purgeUnusedStyles.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ function assertPurged(result) {
5454
expect(result.css).toContain('.text-green-700')
5555
expect(result.css).toContain('.bg-green-100')
5656
expect(result.css).toContain('.text-left')
57+
expect(result.css).toContain('.font-mono')
58+
expect(result.css).toContain('.col-span-4')
59+
expect(result.css).toContain('.tracking-tight')
60+
expect(result.css).toContain('.tracking-tight')
5761
}
5862

5963
test('purges unused classes', () => {

src/lib/purgeUnusedStyles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function purgeUnusedUtilities(config) {
6767
const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || []
6868

6969
// Capture classes within other delimiters like .block(class="w-1/2") in Pug
70-
const innerMatches = content.match(/[^<>"'`\s.()=%]*[^<>"'`\s.()=%:]/g) || []
70+
const innerMatches = content.match(/[^<>"'`\s.(){}\[\]#=%]*[^<>"'`\s.(){}\[\]#=%:]/g) || []
7171

7272
return broadMatches.concat(innerMatches)
7373
},

0 commit comments

Comments
 (0)