Fix CSS/JS paths to relative for static file serving
Absolute paths (/css/site.css) break when opening _site/ directly via file://. Relative paths work with both the dev server and static hosting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9e9cd69ce5
commit
a2fd9a5483
@ -70,7 +70,7 @@ The `ui-kit` page uses `layout: ui-kit` and `css: ui-kit` (links `ui-kit.css` in
|
||||
|
||||
### CSS paths
|
||||
|
||||
All CSS paths in `base.njk` are **absolute** (`/css/site.css`), which requires the 11ty dev server — they will not work when opening `_site/` files directly in a browser via `file://`.
|
||||
All CSS and JS paths in `base.njk` are **relative** (`css/site.css`, `js/inspector.js`). This works both with the 11ty dev server and when opening `_site/` files directly via `file://`.
|
||||
|
||||
### Design tokens
|
||||
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600;700&family=Inter:wght@400;500;600;700;800&family=Manrope:wght@400;500;600;700;800&family=Montserrat:wght@500;600;700;800&family=Playfair+Display:wght@600;700&display=swap" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="/css/{{ css | default('site') }}.css" />
|
||||
<link rel="stylesheet" href="css/{{ css | default('site') }}.css" />
|
||||
</head>
|
||||
<body{% if bodyClass %} class="{{ bodyClass }}"{% endif %}>
|
||||
{{ content | safe }}
|
||||
<script src="/js/inspector.js"></script>
|
||||
<script src="js/inspector.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user