Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(attributify): allow decimal value #2011

Merged
merged 2 commits into from Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/preset-attributify/src/extractor.ts
Expand Up @@ -9,7 +9,7 @@ const strippedPrefixes = [

const splitterRE = /[\s'"`;]+/g
const elementRE = /<\w(?=.*>)[\w:\.$-]*\s((?:['"`\{].*?['"`\}]|.*?)*?)>/gs
const valuedAttributeRE = /([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms
const valuedAttributeRE = /([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-.]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms

export const defaultIgnoreAttributes = ['placeholder']

Expand Down
5 changes: 5 additions & 0 deletions test/__snapshots__/preset-attributify.test.ts.snap
Expand Up @@ -47,6 +47,7 @@ Set {
"[m~=\\"1\\"]",
"[m~=\\"2\\"]",
"[m~=\\"3\\"]",
"[ml-1.5=\\"\\"]",
}
`;

Expand Down Expand Up @@ -157,6 +158,7 @@ Set {
"[m~=\\"1\\"]",
"[m~=\\"2\\"]",
"[m~=\\"3\\"]",
"[ml-1.5=\\"\\"]",
}
`;

Expand All @@ -172,6 +174,7 @@ exports[`attributify > fixture1 1`] = `
[m~=\\"\\\\33 \\"]{margin:0.75rem;}
[ma=\\"\\"],
[un-children~=\\"m-auto\\"]>*{margin:auto;}
[ml-1\\\\.5=\\"\\"]{margin-left:0.375rem;}
[inline-block=\\"\\"]{display:inline-block;}
[flex~=\\"\\\\!\\\\~\\"]{display:flex !important;}
[flex~=\\"col\\"]{flex-direction:column;}
Expand Down Expand Up @@ -283,6 +286,7 @@ exports[`attributify > fixture4 1`] = `
[m~=\\"\\\\33 \\"]{margin:0.75rem;}
[ma=\\"\\"],
[un-children~=\\"m-auto\\"]>*{margin:auto;}
[ml-1\\\\.5=\\"\\"]{margin-left:0.375rem;}
[inline-block=\\"\\"]{display:inline-block;}
[flex~=\\"\\\\!\\\\~\\"]{display:flex !important;}
[flex~=\\"col\\"]{flex-direction:column;}
Expand Down Expand Up @@ -372,5 +376,6 @@ exports[`attributify > variant 1`] = `
"m-1",
"m-2",
"m-3",
"ml-1.5",
]
`;
2 changes: 2 additions & 0 deletions test/preset-attributify.test.ts
Expand Up @@ -35,6 +35,7 @@ describe('attributify', () => {
1 2
3
\`'
ml-1.5
>
Button
</button>
Expand Down Expand Up @@ -108,6 +109,7 @@ describe('attributify', () => {
1 2
3
\`'
ml-1.5
>
Button
</button>
Expand Down