Skip to content

Commit a37b5e3

Browse files
committed
Add support for Astro
1 parent 1a2133b commit a37b5e3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,16 +794,16 @@ function transformCss(ast: any, { env }: TransformerContext) {
794794
}
795795

796796
function transformAstro(ast: any, { env, changes }: TransformerContext) {
797-
let { staticAttrs, dynamicAttrs } = env.customizations
797+
let { staticAttrs, dynamicAttrs, staticAttrsRegex, dynamicAttrsRegex } = env.customizations
798798

799799
if (ast.type === 'element' || ast.type === 'custom-element' || ast.type === 'component') {
800800
for (let attr of ast.attributes ?? []) {
801-
if (staticAttrs.has(attr.name) && attr.type === 'attribute' && attr.kind === 'quoted') {
801+
if (hasMatch(attr.name, staticAttrs, staticAttrsRegex) && attr.type === 'attribute' && attr.kind === 'quoted') {
802802
attr.value = sortClasses(attr.value, {
803803
env,
804804
})
805805
} else if (
806-
dynamicAttrs.has(attr.name) &&
806+
hasMatch(attr.name, dynamicAttrs, dynamicAttrsRegex) &&
807807
attr.type === 'attribute' &&
808808
attr.kind === 'expression' &&
809809
typeof attr.value === 'string'

0 commit comments

Comments
 (0)