Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 170af90

Browse files
committed
fix(create.ts): mediaQuery ordered
1 parent 4f5515c commit 170af90

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/core/method/create.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ export function create<T extends ClassesObjectType>(object: ExactClassesObjectTy
1313
get: function (target, prop: string) {
1414
if (typeof prop === 'string' && prop in target) {
1515
const className = prop + '_' + base62Hash;
16+
const classRuleRegex = new RegExp(`\\n\\.${className}[^{]*\\{[^}]*\\}`, 'g');
1617
const mediaBlockRegex = new RegExp(
1718
`\\n@media[^{]+\\{(?:[^{}]*\\{[^{}]*\\})*[^{}]*\\.${className}[^{}]*\\{[^{}]*\\}(?:[^{}]*\\{[^{}]*\\})*[^{}]*\\}`,
1819
'g'
1920
);
20-
const classRuleRegex = new RegExp(`\\n\\.${className}[^{]*\\{[^}]*\\}`, 'g');
21-
const sheet = (Array.from(styleSheet.match(mediaBlockRegex) || []) as string[])
22-
.concat(Array.from(styleSheet.match(classRuleRegex) || []) as string[])
21+
const sheet = (Array.from(styleSheet.match(classRuleRegex) || []) as string[])
22+
.concat(Array.from(styleSheet.match(mediaBlockRegex) || []) as string[])
2323
.join('');
2424
if (isInDevelopment) injectCSS(className, sheet, 'sheet');
2525

0 commit comments

Comments
 (0)