Support purging Pug templates a bit better

This commit is contained in:
Adam Wathan 2020-04-27 22:18:21 -04:00
parent 4c3e97c9d4
commit b0ac3c50cb
3 changed files with 34 additions and 1 deletions

View file

@ -13,3 +13,10 @@
<!-- Custom classes with really weird characters -->
<div class="min-h-(screen-4) bg-black! font-%#$@ w-(1/2+8)"></div>
<!-- Pug -->
span.inline-grid.grid-cols-3
.col-span-2
Hello
.col-span-1.text-center
World!

View file

@ -594,6 +594,10 @@ video {
display: block;
}
.inline-grid {
display: inline-grid;
}
.font-\%\#\$\@ {
font-family: Comic Sans;
}
@ -602,6 +606,10 @@ video {
height: 100vh;
}
.text-center {
text-align: center;
}
.w-\(1\/2\+8\) {
width: calc(50% + 2rem);
}
@ -610,6 +618,18 @@ video {
width: 50%;
}
.grid-cols-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.col-span-1 {
grid-column: span 1 / span 1;
}
.col-span-2 {
grid-column: span 2 / span 2;
}
.example {
font-weight: 700;
color: #f56565;

View file

@ -50,7 +50,13 @@ export default function purgeUnusedUtilities(config) {
},
purgecss({
content: Array.isArray(config.purge) ? config.purge : config.purge.paths,
defaultExtractor: content => content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || [],
defaultExtractor: content => {
return (
content
.match(/[^<>"'`\s]*[^<>"'`\s:]/g)
.concat(content.match(/[^<>"'`\s.]*[^<>"'`\s:.]/g)) || []
)
},
}),
])
}