Skip to content

Commit b29ed1e

Browse files
committed
Generate css index to import the Marianne font without the DSFR
1 parent de95f00 commit b29ed1e

File tree

2 files changed

+111
-4
lines changed

2 files changed

+111
-4
lines changed

scripts/build/build.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import * as fs from "fs";
55
import { getPatchedRawCssCodeForCompatWithRemixIcon, collectIcons } from "./icons";
66
import { cssToTs } from "./cssToTs";
77
import {
8-
pathOfPatchedRawCssCodeForCompatWithRemixIconRelativeToDsfrDist,
9-
pathOfIconsJson
8+
PATH_OF_PATCHED_RAW_CSS_CODE_FOR_COMPAT_WITH_REMIXICON_RELATIVE_TO_DSFR,
9+
PATH_OF_ICONS_JSON
1010
} from "../../src/bin/only-include-used-icons";
1111
import * as child_process from "child_process";
1212
import { patchCssForMui } from "./patchCssForMui";
@@ -31,10 +31,18 @@ import yargsParser from "yargs-parser";
3131
"recursive": true
3232
});
3333

34+
fs.cpSync(
35+
pathJoin(__dirname, "marianne-index.css"),
36+
pathJoin(dsfrDirPath, "fonts", "index.css")
37+
);
38+
3439
const rawDsfrCssCode = fs.readFileSync(pathJoin(dsfrDirPath, "dsfr.css")).toString("utf8");
3540

3641
fs.writeFileSync(
37-
pathJoin(dsfrDirPath, pathOfPatchedRawCssCodeForCompatWithRemixIconRelativeToDsfrDist),
42+
pathJoin(
43+
dsfrDirPath,
44+
PATH_OF_PATCHED_RAW_CSS_CODE_FOR_COMPAT_WITH_REMIXICON_RELATIVE_TO_DSFR
45+
),
3846
Buffer.from(
3947
getPatchedRawCssCodeForCompatWithRemixIcon({
4048
"rawCssCode": rawDsfrCssCode
@@ -66,7 +74,7 @@ import yargsParser from "yargs-parser";
6674
});
6775

6876
fs.writeFileSync(
69-
pathJoin(dsfrDirPath, pathOfIconsJson),
77+
pathJoin(dsfrDirPath, PATH_OF_ICONS_JSON),
7078
Buffer.from(JSON.stringify(icons, null, 2), "utf8")
7179
);
7280

scripts/build/marianne-index.css

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
@font-face {
2+
font-family: Marianne;
3+
src:
4+
url("./Marianne-Light.woff2") format("woff2"),
5+
url("./Marianne-Light.woff") format("woff");
6+
font-weight: 300;
7+
font-style: normal;
8+
font-display: swap;
9+
}
10+
11+
@font-face {
12+
font-family: Marianne;
13+
src:
14+
url("./Marianne-Light_Italic.woff2") format("woff2"),
15+
url("./Marianne-Light_Italic.woff") format("woff");
16+
font-weight: 300;
17+
font-style: italic;
18+
font-display: swap;
19+
}
20+
21+
@font-face {
22+
font-family: Marianne;
23+
src:
24+
url("./Marianne-Regular.woff2") format("woff2"),
25+
url("./Marianne-Regular.woff") format("woff");
26+
font-weight: 400;
27+
font-style: normal;
28+
font-display: swap;
29+
}
30+
31+
@font-face {
32+
font-family: Marianne;
33+
src:
34+
url("./Marianne-Regular_Italic.woff2") format("woff2"),
35+
url("./Marianne-Regular_Italic.woff") format("woff");
36+
font-weight: 400;
37+
font-style: italic;
38+
font-display: swap;
39+
}
40+
41+
@font-face {
42+
font-family: Marianne;
43+
src:
44+
url("./Marianne-Medium.woff2") format("woff2"),
45+
url("./Marianne-Medium.woff") format("woff");
46+
font-weight: 500;
47+
font-style: normal;
48+
font-display: swap;
49+
}
50+
51+
@font-face {
52+
font-family: Marianne;
53+
src:
54+
url("./Marianne-Medium_Italic.woff2") format("woff2"),
55+
url("./Marianne-Medium_Italic.woff") format("woff");
56+
font-weight: 500;
57+
font-style: italic;
58+
font-display: swap;
59+
}
60+
61+
@font-face {
62+
font-family: Marianne;
63+
src:
64+
url("./Marianne-Bold.woff2") format("woff2"),
65+
url("./Marianne-Bold.woff") format("woff");
66+
font-weight: 700;
67+
font-style: normal;
68+
font-display: swap;
69+
}
70+
71+
@font-face {
72+
font-family: Marianne;
73+
src:
74+
url("./Marianne-Bold_Italic.woff2") format("woff2"),
75+
url("./Marianne-Bold_Italic.woff") format("woff");
76+
font-weight: 700;
77+
font-style: italic;
78+
font-display: swap;
79+
}
80+
81+
@font-face {
82+
font-family: Spectral;
83+
src:
84+
url("./Spectral-Regular.woff2") format("woff2"),
85+
url("./Spectral-Regular.woff") format("woff");
86+
font-weight: 400;
87+
font-style: normal;
88+
font-display: swap;
89+
}
90+
91+
@font-face {
92+
font-family: Spectral;
93+
src:
94+
url("./Spectral-ExtraBold.woff2") format("woff2"),
95+
url("./Spectral-ExtraBold.woff") format("woff");
96+
font-weight: 900;
97+
font-style: normal;
98+
font-display: swap;
99+
}

0 commit comments

Comments
 (0)