Skip to content

Commit e39f31b

Browse files
committed
Pase classes rules in @suports, adds .fr-ratio-... classes
1 parent 75898a2 commit e39f31b

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

scripts/build/cssToTs/breakpoints.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ export const getRulesByBreakpoint = memoize((rawCssCode: string): RulesByBreakpo
114114
({ type }) => type === "rule"
115115
);
116116

117+
(parsedCss.stylesheet!.rules as any[])
118+
.filter(({ type }) => type === "supports")
119+
.forEach(({ rules }: any) =>
120+
rulesByBreakpoint.root.push(...rules.filter(({ type }: any) => type === "rule"))
121+
);
122+
117123
(parsedCss.stylesheet!.rules as any[])
118124
.filter(({ type }) => type === "media")
119125
.filter(({ media }) => Object.values(mediaQueryByBreakpoint).includes(media))

test/runtime/scripts/classNames/parseClassNames.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ it("Parsing of fr classnames", () => {
2424
color: #3a3a3a;
2525
}
2626
27+
@supports (aspect-ratio: 16/9) {
28+
.fr-ratio-32x9 {
29+
aspect-ratio: 3.5555555556 !important;
30+
}
31+
32+
.fr-ratio-16x9 {
33+
aspect-ratio: 1.7777777778 !important;
34+
}
35+
}
36+
37+
2738
@media (min-width: 36em) { }
2839
@media (min-width: 48em) { }
2940
@media (min-width: 62em) { }
@@ -38,7 +49,9 @@ it("Parsing of fr classnames", () => {
3849
"fr-grid-row--gutters",
3950
"fr-col",
4051
"fr-header__navbar",
41-
"fr-btn--menu"
52+
"fr-btn--menu",
53+
"fr-ratio-32x9",
54+
"fr-ratio-16x9"
4255
];
4356

4457
const got = parseClassNames(input);

0 commit comments

Comments
 (0)