Skip to content

Commit ebac0ca

Browse files
committed
Avoid generating empty media query
1 parent e429f30 commit ebac0ca

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/bin/css_to_ts/icons.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ export function generateIconsRawCssCode(params: {
4545

4646
return [
4747
...usedIcons.map(icon => buildRule(icon, false)),
48-
`@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {`,
49-
...usedIcons.map(icon => buildRule(icon, true)),
50-
`}`,
51-
``,
48+
...(usedIcons.length === 0
49+
? []
50+
: [
51+
`@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {`,
52+
...usedIcons.map(icon => buildRule(icon, true)),
53+
`}`,
54+
``
55+
]),
5256
...(usedIcons.find(({ prefix }) => prefix === "ri-") !== undefined
5357
? [
5458
`/* This is all the parts of dsfr.css related to icons with .fr-icon- replaced by .ri- so that we can use remixicon as dsfr icons*/`,

0 commit comments

Comments
 (0)