Skip to content

Commit 8a0558e

Browse files
committed
feat: integrate rollup-plugin-visualizer for bundle analysis and optimize resource loading
1 parent 46b5774 commit 8a0558e

File tree

4 files changed

+218
-7
lines changed

4 files changed

+218
-7
lines changed

website/.vitepress/config.ts

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
import { defineConfig } from 'vitepress';
22
import tailwindcss from '@tailwindcss/vite';
3+
import { visualizer } from 'rollup-plugin-visualizer';
34

45
export default defineConfig({
56
vite: {
6-
plugins: [tailwindcss()],
7+
plugins: [
8+
tailwindcss(),
9+
// Bundle analyzer - generates stats.html after build
10+
visualizer({
11+
filename: '.vitepress/dist/stats.html',
12+
open: false,
13+
gzipSize: true,
14+
brotliSize: true,
15+
}),
16+
],
17+
},
18+
19+
// Configure Shiki for minimal bundle size
20+
// See: https://shiki.style/guide/bundles
21+
markdown: {
22+
theme: {
23+
light: 'github-light',
24+
dark: 'github-dark',
25+
},
726
},
827

928
appearance: true, // Enable dark mode toggle
@@ -14,10 +33,20 @@ export default defineConfig({
1433
cleanUrls: true,
1534

1635
head: [
17-
// Preconnect for faster font loading
36+
// Preconnect for faster resource loading
1837
['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }],
1938
['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }],
2039
['link', { rel: 'preconnect', href: 'https://api.iconify.design' }],
40+
['link', { rel: 'preconnect', href: 'https://flow.demo.vyuh.tech' }],
41+
// Non-blocking font loading (moved from CSS @import for better performance)
42+
['link', {
43+
rel: 'stylesheet',
44+
href: 'https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400&family=Montserrat:wght@400;600;800;900&display=swap',
45+
media: 'print',
46+
onload: "this.media='all'"
47+
}],
48+
// Fallback for browsers with JS disabled
49+
['noscript', {}, '<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400&family=Montserrat:wght@400;600;800;900&display=swap">'],
2150
['link', { rel: 'icon', href: '/icon.svg', type: 'image/svg+xml' }],
2251
['meta', { property: 'og:type', content: 'website' }],
2352
['meta', { property: 'og:title', content: 'Vyuh Node Flow - Visual Flow Editor for Flutter' }],

website/.vitepress/theme/style.css

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* Vyuh Node Flow - Global Tailwind CSS Styles */
22

3-
/* Reduced font weights for better performance */
4-
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400&family=Montserrat:wght@400;600;800;900&display=swap');
3+
/* Fonts are loaded via <link> tags in config.ts head for non-blocking loading */
54
@import "tailwindcss";
65

76
/* Configure Tailwind to use class-based dark mode (VitePress uses .dark class) */
@@ -13,9 +12,9 @@
1312
═══════════════════════════════════════════════════════════════════ */
1413

1514
:root {
16-
/* Typography */
17-
--vn-font-display: 'Montserrat', sans-serif;
18-
--vn-font-mono: 'JetBrains Mono', monospace;
15+
/* Typography - system font stacks as fallbacks for FOUT prevention */
16+
--vn-font-display: 'Montserrat', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
17+
--vn-font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
1918

2019
/* Animation */
2120
--vn-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"devDependencies": {
1212
"@iconify/vue": "^5.0.0",
13+
"rollup-plugin-visualizer": "^6.0.5",
1314
"vitepress": "next",
1415
"vue": "^3.5.26"
1516
},

0 commit comments

Comments
 (0)