Improve support for purging Haml even more

This commit is contained in:
Adam Wathan 2020-04-30 08:40:42 -04:00
parent cdef9c8d4d
commit 9032ff33ed
3 changed files with 8 additions and 2 deletions

View File

@ -34,4 +34,6 @@ span.inline-grid.grid-cols-3(class="px-1.5")
.flow-root
.text-green-700.bg-green-100
.text-left= content
%samp= output
%samp.font-mono{:data-foo => "bar"}= output
.col-span-4[aria-hidden=true]
.tracking-tight#headline

View File

@ -54,6 +54,10 @@ function assertPurged(result) {
expect(result.css).toContain('.text-green-700')
expect(result.css).toContain('.bg-green-100')
expect(result.css).toContain('.text-left')
expect(result.css).toContain('.font-mono')
expect(result.css).toContain('.col-span-4')
expect(result.css).toContain('.tracking-tight')
expect(result.css).toContain('.tracking-tight')
}
test('purges unused classes', () => {

View File

@ -67,7 +67,7 @@ export default function purgeUnusedUtilities(config) {
const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || []
// Capture classes within other delimiters like .block(class="w-1/2") in Pug
const innerMatches = content.match(/[^<>"'`\s.()=%]*[^<>"'`\s.()=%:]/g) || []
const innerMatches = content.match(/[^<>"'`\s.(){}\[\]#=%]*[^<>"'`\s.(){}\[\]#=%:]/g) || []
return broadMatches.concat(innerMatches)
},