Skip to content

Commit 4cc33a0

Browse files
authored
Merge pull request #19 from code4rena-dev/samus/reduce-bundle-size
Move fonts to reduce bundle size
2 parents 4d3ec51 + 6540dfe commit 4cc33a0

File tree

6 files changed

+25
-4
lines changed

6 files changed

+25
-4
lines changed

.storybook/main.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type { StorybookConfig } from "@storybook/react-webpack5";
2+
import path from "path";
3+
24
const config: StorybookConfig = {
35
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
46
staticDirs: ["../public"],
@@ -22,5 +24,23 @@ const config: StorybookConfig = {
2224
docs: {
2325
autodocs: "tag",
2426
},
27+
webpackFinal: async (config) => {
28+
if (config.resolve) {
29+
config.resolve = {
30+
...config.resolve,
31+
alias: {
32+
...config.resolve.alias,
33+
"/fonts": path.resolve(__dirname, "../public/fonts"),
34+
},
35+
};
36+
} else {
37+
config.resolve = {
38+
alias: {
39+
"/fonts": path.resolve(__dirname, "../public/fonts"),
40+
},
41+
};
42+
}
43+
return config;
44+
},
2545
};
2646
export default config;

src/styles/base/typography.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
@font-face {
99
font-family: "Satoshi Variable";
10-
src: url("../fonts/Satoshi-Variable.woff2") format("woff2"),
11-
url("../fonts/Satoshi-Variable.woff") format("woff"),
12-
url("../fonts/Satoshi-Variable.ttf") format("truetype");
10+
src: url("/fonts/Satoshi-Variable.woff2") format("woff2"),
11+
url("/fonts/Satoshi-Variable.woff") format("woff"),
12+
url("/fonts/Satoshi-Variable.ttf") format("truetype");
1313
font-weight: 300 900;
1414
font-display: swap;
1515
font-style: normal;

vercel.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"devCommand": "npm run storybook",
55
"installCommand": "npm install",
66
"framework": null,
7-
"outputDirectory": "./storybook-static"
7+
"outputDirectory": "./storybook-static",
8+
"public": true
89
}

0 commit comments

Comments
 (0)