Skip to content

Commit 8f4f727

Browse files
Site: More improvements (#125)
1 parent ad24282 commit 8f4f727

File tree

4 files changed

+34
-18
lines changed

4 files changed

+34
-18
lines changed

site/src/Code/Code.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ export default ({
121121
/>
122122
</Box>
123123
<Text color="secondary" size="xsmall" type="code">
124-
{title || resolvedTitle}
124+
<Box
125+
component="span"
126+
color={{ lightMode: 'coolGray400', darkMode: 'gray400' }}
127+
>
128+
{title || resolvedTitle}
129+
</Box>
125130
</Text>
126131
</Box>
127132
) : null}

site/src/HomePage/HomePage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,9 @@ const Feature = ({
683683
borderRadius="medium"
684684
/>
685685
<Stack space="xlarge">
686-
<Heading level="4">{title}</Heading>
686+
<Heading level="4" component="h2">
687+
{title}
688+
</Heading>
687689
<Text size="small" color="secondary">
688690
{children}
689691
</Text>

site/src/render.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,38 @@ export default ({ route, publicPath, entrypoints }: RenderParams) => {
3434
throw new Error('No assets!');
3535
}
3636

37-
const cssAssets = assets
38-
.filter((asset) => asset.name.endsWith('.css'))
39-
.map(
40-
(asset) =>
41-
`<link rel="stylesheet" href="${assetPath(asset.name)}"></link>`,
42-
);
43-
const jsAssets = assets
44-
.filter((asset) => asset.name.endsWith('.js'))
45-
.map((asset) => `<script src="${assetPath(asset.name)}"></script>`);
37+
const cssAssets = assets.filter((asset) => asset.name.endsWith('.css'));
38+
const jsAssets = assets.filter((asset) => asset.name.endsWith('.js'));
4639

4740
const headTags: HeadTags = [];
4841
const html = render(route, headTags);
4942

5043
const favicon = (size?: number) =>
5144
`<link rel="icon" type="image/png" ${
5245
size ? `sizes="${size}x${size}" ` : ''
53-
}href="${assetPath(`favicon${size ? `-${size}x${size}` : ''}.png`)}" />`;
46+
}href="${assetPath(`favicon${size ? `-${size}x${size}.png` : '.ico'}`)}">`;
5447

5548
const shareImageUrl = fullyQualifiedUrl(assetPath('og-image.png'));
5649

57-
return `<html>
50+
return `
51+
<!DOCTYPE html>
52+
<html lang="en">
5853
<head>
5954
<script>
6055
((d)=>{try{var p=localStorage.getItem('${themeKey}');if(p==d||(p!='${lightMode}'&&matchMedia('(prefers-color-scheme:dark)').matches)) document.documentElement.classList.add(d)}catch(e){}})('${darkMode}')
6156
</script>
6257
<link href="https://fonts.googleapis.com/css?family=Shrikhand&display=swap" rel="stylesheet">
6358
<link href="https://fonts.googleapis.com/css?family=DM+Sans&display=swap" rel="stylesheet">
6459
<link href="https://www.monolisa.dev/api/fonts/initial" rel="stylesheet">
65-
${cssAssets.join('\n')}
60+
${cssAssets
61+
.map(({ name }) => `<link rel="stylesheet" href="${assetPath(name)}">`)
62+
.join('\n')}
63+
${jsAssets
64+
.map(
65+
({ name }) =>
66+
`<link rel="preload" as="script" href="${assetPath(name)}">`,
67+
)
68+
.join('\n')}
6669
${renderToString(<Fragment>{headTags}</Fragment>)}
6770
<meta name="viewport" content="width=device-width, initial-scale=1">
6871
<meta name="theme-color" content="#fff"/>
@@ -84,7 +87,9 @@ export default ({ route, publicPath, entrypoints }: RenderParams) => {
8487
</head>
8588
<body>
8689
<div id="app">${html}</div>
87-
${jsAssets.join('\n')}
90+
${jsAssets
91+
.map(({ name }) => `<script async src="${assetPath(name)}"></script>`)
92+
.join('\n')}
8893
</body>
8994
</html>`;
9095
};

site/webpack.config.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,13 @@ module.exports = [
9292
new CopyPlugin({
9393
patterns: [{ from: join(__dirname, 'src/assets') }],
9494
}),
95-
new BundleAnalyzerPlugin({
96-
openAnalyzer: false,
97-
}),
95+
...(process.env.CI !== 'true'
96+
? [
97+
new BundleAnalyzerPlugin({
98+
openAnalyzer: false,
99+
}),
100+
]
101+
: []),
98102
],
99103
stats: 'errors-only',
100104
},

0 commit comments

Comments
 (0)