@alliance-droid/svelte-docs-system 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENTS.md +365 -0
- package/COVERAGE_REPORT.md +663 -0
- package/README.md +42 -0
- package/SEARCH_VERIFICATION.md +229 -0
- package/TEST_SUMMARY.md +344 -0
- package/bin/init.js +821 -0
- package/docs/E2E_TESTS.md +354 -0
- package/docs/TESTING.md +754 -0
- package/docs/de/index.md +41 -0
- package/docs/en/COMPONENTS.md +443 -0
- package/docs/en/api/examples.md +100 -0
- package/docs/en/api/overview.md +69 -0
- package/docs/en/components/index.md +622 -0
- package/docs/en/config/navigation.md +505 -0
- package/docs/en/config/theme-and-colors.md +395 -0
- package/docs/en/getting-started/integration.md +406 -0
- package/docs/en/guides/common-setups.md +651 -0
- package/docs/en/index.md +243 -0
- package/docs/en/markdown.md +102 -0
- package/docs/en/routing.md +64 -0
- package/docs/en/setup.md +52 -0
- package/docs/en/troubleshooting.md +704 -0
- package/docs/es/index.md +41 -0
- package/docs/fr/index.md +41 -0
- package/docs/ja/index.md +41 -0
- package/package.json +40 -0
- package/pagefind.toml +8 -0
- package/postcss.config.js +5 -0
- package/src/app.css +119 -0
- package/src/app.d.ts +13 -0
- package/src/app.html +11 -0
- package/src/lib/assets/favicon.svg +1 -0
- package/src/lib/components/APITable.svelte +120 -0
- package/src/lib/components/APITable.test.ts +153 -0
- package/src/lib/components/Breadcrumbs.svelte +85 -0
- package/src/lib/components/Breadcrumbs.test.ts +148 -0
- package/src/lib/components/Callout.svelte +60 -0
- package/src/lib/components/Callout.test.ts +100 -0
- package/src/lib/components/CodeBlock.svelte +68 -0
- package/src/lib/components/CodeBlock.test.ts +133 -0
- package/src/lib/components/DocLayout.svelte +84 -0
- package/src/lib/components/Footer.svelte +78 -0
- package/src/lib/components/Image.svelte +100 -0
- package/src/lib/components/Image.test.ts +163 -0
- package/src/lib/components/Navbar.svelte +141 -0
- package/src/lib/components/Search.svelte +248 -0
- package/src/lib/components/Sidebar.svelte +110 -0
- package/src/lib/components/Tabs.svelte +48 -0
- package/src/lib/components/Tabs.test.ts +102 -0
- package/src/lib/config.test.ts +140 -0
- package/src/lib/config.ts +179 -0
- package/src/lib/configIntegration.test.ts +272 -0
- package/src/lib/configLoader.ts +231 -0
- package/src/lib/configParser.test.ts +217 -0
- package/src/lib/configParser.ts +234 -0
- package/src/lib/index.ts +34 -0
- package/src/lib/integration.test.ts +426 -0
- package/src/lib/navigationBuilder.test.ts +338 -0
- package/src/lib/navigationBuilder.ts +268 -0
- package/src/lib/performance.test.ts +369 -0
- package/src/lib/routing.test.ts +202 -0
- package/src/lib/routing.ts +127 -0
- package/src/lib/search-functionality.test.ts +493 -0
- package/src/lib/stores/i18n.test.ts +180 -0
- package/src/lib/stores/i18n.ts +143 -0
- package/src/lib/stores/nav.ts +36 -0
- package/src/lib/stores/search.test.ts +140 -0
- package/src/lib/stores/search.ts +162 -0
- package/src/lib/stores/theme.ts +59 -0
- package/src/lib/stores/version.test.ts +139 -0
- package/src/lib/stores/version.ts +111 -0
- package/src/lib/themeCustomization.test.ts +223 -0
- package/src/lib/themeCustomization.ts +212 -0
- package/src/lib/utils/highlight.test.ts +136 -0
- package/src/lib/utils/highlight.ts +100 -0
- package/src/lib/utils/index.ts +7 -0
- package/src/lib/utils/markdown.test.ts +357 -0
- package/src/lib/utils/markdown.ts +77 -0
- package/src/routes/+layout.server.ts +1 -0
- package/src/routes/+layout.svelte +28 -0
- package/src/routes/+page.svelte +165 -0
- package/static/robots.txt +3 -0
- package/svelte.config.js +18 -0
- package/tailwind.config.ts +55 -0
- package/template-starter/.github/workflows/build.yml +40 -0
- package/template-starter/.github/workflows/deploy-github-pages.yml +47 -0
- package/template-starter/.github/workflows/deploy-netlify.yml +41 -0
- package/template-starter/.github/workflows/deploy-vercel.yml +64 -0
- package/template-starter/NPM-PACKAGE-SETUP.md +233 -0
- package/template-starter/README.md +320 -0
- package/template-starter/docs/_config.json +39 -0
- package/template-starter/docs/api/components.md +257 -0
- package/template-starter/docs/api/overview.md +169 -0
- package/template-starter/docs/guides/configuration.md +145 -0
- package/template-starter/docs/guides/github-pages-deployment.md +254 -0
- package/template-starter/docs/guides/netlify-deployment.md +159 -0
- package/template-starter/docs/guides/vercel-deployment.md +131 -0
- package/template-starter/docs/index.md +49 -0
- package/template-starter/docs/setup.md +149 -0
- package/template-starter/package.json +31 -0
- package/template-starter/pagefind.toml +3 -0
- package/template-starter/postcss.config.js +5 -0
- package/template-starter/src/app.css +34 -0
- package/template-starter/src/app.d.ts +13 -0
- package/template-starter/src/app.html +11 -0
- package/template-starter/src/lib/components/APITable.svelte +120 -0
- package/template-starter/src/lib/components/APITable.test.ts +19 -0
- package/template-starter/src/lib/components/Breadcrumbs.svelte +85 -0
- package/template-starter/src/lib/components/Breadcrumbs.test.ts +19 -0
- package/template-starter/src/lib/components/Callout.svelte +60 -0
- package/template-starter/src/lib/components/Callout.test.ts +16 -0
- package/template-starter/src/lib/components/CodeBlock.svelte +68 -0
- package/template-starter/src/lib/components/CodeBlock.test.ts +12 -0
- package/template-starter/src/lib/components/DocLayout.svelte +84 -0
- package/template-starter/src/lib/components/Footer.svelte +78 -0
- package/template-starter/src/lib/components/Image.svelte +100 -0
- package/template-starter/src/lib/components/Image.test.ts +15 -0
- package/template-starter/src/lib/components/Navbar.svelte +141 -0
- package/template-starter/src/lib/components/Search.svelte +248 -0
- package/template-starter/src/lib/components/Sidebar.svelte +110 -0
- package/template-starter/src/lib/components/Tabs.svelte +48 -0
- package/template-starter/src/lib/components/Tabs.test.ts +17 -0
- package/template-starter/src/lib/index.ts +15 -0
- package/template-starter/src/routes/+layout.svelte +28 -0
- package/template-starter/src/routes/+page.svelte +92 -0
- package/template-starter/svelte.config.js +17 -0
- package/template-starter/tailwind.config.ts +17 -0
- package/template-starter/tsconfig.json +13 -0
- package/template-starter/vite.config.ts +6 -0
- package/tests/e2e/example.spec.ts +345 -0
- package/tsconfig.json +20 -0
- package/vite.config.ts +6 -0
- package/vitest.config.ts +34 -0
- package/vitest.setup.ts +21 -0
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Troubleshooting Guide
|
|
3
|
+
description: Solutions for common issues and problems
|
|
4
|
+
author: Andrew
|
|
5
|
+
date: 2026-02-05
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Troubleshooting Guide
|
|
9
|
+
|
|
10
|
+
Solutions for common problems when using the SvelteKit Documentation System.
|
|
11
|
+
|
|
12
|
+
## Build & Development Issues
|
|
13
|
+
|
|
14
|
+
### Problem: `npm run dev` fails with module errors
|
|
15
|
+
|
|
16
|
+
**Error Message:**
|
|
17
|
+
```
|
|
18
|
+
Error: Cannot find module '@sveltejs/kit'
|
|
19
|
+
Module not found
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Solution:**
|
|
23
|
+
1. Ensure all dependencies are installed:
|
|
24
|
+
```bash
|
|
25
|
+
npm install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
2. Clear the `.svelte-kit` build cache:
|
|
29
|
+
```bash
|
|
30
|
+
rm -rf .svelte-kit
|
|
31
|
+
npm run dev
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
3. If issue persists, reinstall node_modules:
|
|
35
|
+
```bash
|
|
36
|
+
rm -rf node_modules
|
|
37
|
+
npm install
|
|
38
|
+
npm run dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Prevention:**
|
|
42
|
+
- Run `npm install` after pulling new changes
|
|
43
|
+
- Commit `package-lock.json` to version control
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### Problem: TypeScript compilation errors
|
|
48
|
+
|
|
49
|
+
**Error Message:**
|
|
50
|
+
```
|
|
51
|
+
src/lib/components/DocLayout.svelte:12 error
|
|
52
|
+
Type '...' is not assignable to type 'unknown'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Solution:**
|
|
56
|
+
1. Check your `tsconfig.json` is correct:
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"compilerOptions": {
|
|
60
|
+
"strict": true,
|
|
61
|
+
"target": "ES2020",
|
|
62
|
+
"module": "ESNext"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2. Rebuild TypeScript cache:
|
|
68
|
+
```bash
|
|
69
|
+
npm run check
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
3. Review the specific error - ensure props match component interface
|
|
73
|
+
|
|
74
|
+
**Prevention:**
|
|
75
|
+
- Run `npm run check` before commits
|
|
76
|
+
- Enable TypeScript strict mode in your IDE
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Problem: Tailwind CSS not compiling
|
|
81
|
+
|
|
82
|
+
**Symptoms:**
|
|
83
|
+
- Page appears completely unstyled
|
|
84
|
+
- No colors or spacing applied
|
|
85
|
+
- Classes like `text-blue-500` don't work
|
|
86
|
+
|
|
87
|
+
**Solution:**
|
|
88
|
+
1. Verify `tailwind.config.ts` exists and is correct:
|
|
89
|
+
```bash
|
|
90
|
+
cat tailwind.config.ts
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
2. Check `src/app.css` includes Tailwind directives:
|
|
94
|
+
```css
|
|
95
|
+
@tailwind base;
|
|
96
|
+
@tailwind components;
|
|
97
|
+
@tailwind utilities;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. Ensure Tailwind is installed:
|
|
101
|
+
```bash
|
|
102
|
+
npm install -D tailwindcss postcss autoprefixer
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
4. Check `postcss.config.js`:
|
|
106
|
+
```js
|
|
107
|
+
export default {
|
|
108
|
+
plugins: {
|
|
109
|
+
tailwindcss: {},
|
|
110
|
+
autoprefixer: {},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
5. Restart dev server:
|
|
116
|
+
```bash
|
|
117
|
+
npm run dev
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Prevention:**
|
|
121
|
+
- Run `npm run check` to verify CSS compilation
|
|
122
|
+
- Don't manually edit compiled CSS files
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Routing & Navigation Issues
|
|
127
|
+
|
|
128
|
+
### Problem: Documentation pages return 404
|
|
129
|
+
|
|
130
|
+
**Symptoms:**
|
|
131
|
+
- Clicking sidebar links shows "Not Found"
|
|
132
|
+
- URL bar shows `/docs/setup` but page doesn't load
|
|
133
|
+
- Even `http://localhost:5173/docs` shows 404
|
|
134
|
+
|
|
135
|
+
**Solution:**
|
|
136
|
+
1. Verify route files exist:
|
|
137
|
+
```bash
|
|
138
|
+
ls -la src/routes/docs/
|
|
139
|
+
# Should show: +layout.svelte, [...slug]/, etc.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
2. Check markdown files exist:
|
|
143
|
+
```bash
|
|
144
|
+
ls -la docs/
|
|
145
|
+
# Should show: index.md, setup.md, etc.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
3. Verify `[...slug]/+page.svelte` fetches from correct path:
|
|
149
|
+
```svelte
|
|
150
|
+
const path = `/docs/${slug}.md`; // ← Correct
|
|
151
|
+
// NOT: const path = `docs/${slug}.md`; // ← Wrong
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
4. Check file names don't have spaces (use hyphens):
|
|
155
|
+
```bash
|
|
156
|
+
# Correct:
|
|
157
|
+
setup.md
|
|
158
|
+
getting-started.md
|
|
159
|
+
|
|
160
|
+
# Incorrect:
|
|
161
|
+
Setup Guide.md
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
5. Clear SvelteKit build cache and rebuild:
|
|
165
|
+
```bash
|
|
166
|
+
rm -rf .svelte-kit
|
|
167
|
+
npm run dev
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Prevention:**
|
|
171
|
+
- Use consistent naming: lowercase with hyphens
|
|
172
|
+
- Keep documentation files in `docs/` folder
|
|
173
|
+
- Test route handlers by visiting `/docs` directly
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### Problem: Sidebar doesn't show navigation items
|
|
178
|
+
|
|
179
|
+
**Symptoms:**
|
|
180
|
+
- Sidebar appears but no items are listed
|
|
181
|
+
- "Getting Started" section shows but no links underneath
|
|
182
|
+
- Navigation is completely empty
|
|
183
|
+
|
|
184
|
+
**Solution:**
|
|
185
|
+
1. Verify `sections` array is defined in `+layout.svelte`:
|
|
186
|
+
```svelte
|
|
187
|
+
const sections: NavSection[] = [
|
|
188
|
+
{
|
|
189
|
+
title: 'Getting Started',
|
|
190
|
+
items: [
|
|
191
|
+
{ label: 'Home', href: '/docs' },
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
];
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
2. Check `sections` is passed to `DocLayout`:
|
|
198
|
+
```svelte
|
|
199
|
+
<DocLayout {sections} title="Docs">
|
|
200
|
+
<slot />
|
|
201
|
+
</DocLayout>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
3. Verify href paths start with correct mount point:
|
|
205
|
+
```typescript
|
|
206
|
+
// Correct:
|
|
207
|
+
{ label: 'Home', href: '/docs' }
|
|
208
|
+
|
|
209
|
+
// Incorrect:
|
|
210
|
+
{ label: 'Home', href: '/help' } // Wrong mount point
|
|
211
|
+
{ label: 'Home', href: 'docs' } // Missing leading slash
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
4. Ensure `NavSection` and `NavItem` types match:
|
|
215
|
+
```typescript
|
|
216
|
+
interface NavSection {
|
|
217
|
+
title: string;
|
|
218
|
+
items: NavItem[];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface NavItem {
|
|
222
|
+
label: string;
|
|
223
|
+
href?: string;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Prevention:**
|
|
228
|
+
- Test navigation in browser dev tools
|
|
229
|
+
- Log `sections` to console to verify structure
|
|
230
|
+
- Use TypeScript strict mode to catch type errors
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### Problem: Sidebar is hidden or not responsive on mobile
|
|
235
|
+
|
|
236
|
+
**Symptoms:**
|
|
237
|
+
- Sidebar doesn't appear on mobile devices
|
|
238
|
+
- Hamburger menu doesn't toggle sidebar
|
|
239
|
+
- Sidebar doesn't close after clicking links on mobile
|
|
240
|
+
|
|
241
|
+
**Solution:**
|
|
242
|
+
1. Check hamburger button is in navbar:
|
|
243
|
+
```svelte
|
|
244
|
+
<!-- Should be in Navbar.svelte -->
|
|
245
|
+
<button class="md:hidden" on:click={() => sidebarOpen.toggle()}>
|
|
246
|
+
<i class="fa-solid fa-bars"></i>
|
|
247
|
+
</button>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
2. Verify `sidebarOpen` store is imported:
|
|
251
|
+
```typescript
|
|
252
|
+
import { sidebarOpen } from '$lib/stores/nav';
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
3. Check media query in styles:
|
|
256
|
+
```svelte
|
|
257
|
+
<!-- Sidebar should hide on mobile -->
|
|
258
|
+
<aside class="hidden md:block">
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
4. Test in browser dev tools:
|
|
262
|
+
- Open DevTools (F12)
|
|
263
|
+
- Go to Device Toolbar (Ctrl+Shift+M)
|
|
264
|
+
- Change viewport size
|
|
265
|
+
- Verify sidebar behavior
|
|
266
|
+
|
|
267
|
+
**Prevention:**
|
|
268
|
+
- Test responsive design regularly
|
|
269
|
+
- Use browser dev tools mobile emulation
|
|
270
|
+
- Test on actual mobile devices before deployment
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Styling & Theme Issues
|
|
275
|
+
|
|
276
|
+
### Problem: Dark mode doesn't work
|
|
277
|
+
|
|
278
|
+
**Symptoms:**
|
|
279
|
+
- Toggle button exists but clicking does nothing
|
|
280
|
+
- Theme doesn't persist on page reload
|
|
281
|
+
- Page doesn't respect system dark mode preference
|
|
282
|
+
|
|
283
|
+
**Solution:**
|
|
284
|
+
1. Verify theme store is initialized in main layout:
|
|
285
|
+
```svelte
|
|
286
|
+
<!-- src/routes/+layout.svelte -->
|
|
287
|
+
<script lang="ts">
|
|
288
|
+
import { theme } from '$lib/stores/theme';
|
|
289
|
+
import { onMount } from 'svelte';
|
|
290
|
+
|
|
291
|
+
onMount(() => {
|
|
292
|
+
// Initialize theme from localStorage
|
|
293
|
+
const stored = localStorage.getItem('theme') || 'system';
|
|
294
|
+
theme.set(stored as any);
|
|
295
|
+
});
|
|
296
|
+
</script>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
2. Check dark colors are defined in `tailwind.config.ts`:
|
|
300
|
+
```typescript
|
|
301
|
+
colors: {
|
|
302
|
+
'claude-dark-bg': '#1A1A1A',
|
|
303
|
+
'claude-dark-text': '#FFFFFF',
|
|
304
|
+
// ... etc
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
3. Verify `darkMode: 'class'` is set:
|
|
309
|
+
```typescript
|
|
310
|
+
export default {
|
|
311
|
+
darkMode: 'class',
|
|
312
|
+
// ...
|
|
313
|
+
} satisfies Config;
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
4. Test theme store directly in browser console:
|
|
317
|
+
```javascript
|
|
318
|
+
// Open DevTools console
|
|
319
|
+
localStorage.setItem('theme', 'dark');
|
|
320
|
+
window.location.reload();
|
|
321
|
+
// Should switch to dark mode
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
5. Check HTML root element has `dark` class:
|
|
325
|
+
```html
|
|
326
|
+
<!-- DevTools > Elements > <html> -->
|
|
327
|
+
<!-- Should have: class="dark" when dark mode is enabled -->
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Prevention:**
|
|
331
|
+
- Test dark mode toggle frequently
|
|
332
|
+
- Test theme persistence across page reloads
|
|
333
|
+
- Verify contrast ratios in both themes
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
### Problem: Custom colors aren't applied
|
|
338
|
+
|
|
339
|
+
**Symptoms:**
|
|
340
|
+
- Changed `tailwind.config.ts` but colors don't update
|
|
341
|
+
- Custom background color shows as default
|
|
342
|
+
- Sidebar doesn't use your brand colors
|
|
343
|
+
|
|
344
|
+
**Solution:**
|
|
345
|
+
1. Verify config changes are correct:
|
|
346
|
+
```typescript
|
|
347
|
+
export default {
|
|
348
|
+
theme: {
|
|
349
|
+
extend: {
|
|
350
|
+
colors: {
|
|
351
|
+
'claude-bg': '#YOUR_COLOR',
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
} satisfies Config;
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
2. Use correct color names in components:
|
|
359
|
+
```svelte
|
|
360
|
+
<!-- Correct: -->
|
|
361
|
+
<div class="bg-claude-bg">Content</div>
|
|
362
|
+
|
|
363
|
+
<!-- Incorrect: -->
|
|
364
|
+
<div class="bg-white">Content</div> <!-- Uses default Tailwind -->
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
3. Restart dev server:
|
|
368
|
+
```bash
|
|
369
|
+
npm run dev
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
4. Clear browser cache:
|
|
373
|
+
- Ctrl+Shift+Delete (or Cmd+Shift+Delete on Mac)
|
|
374
|
+
- Select "Cached images and files"
|
|
375
|
+
- Clear
|
|
376
|
+
|
|
377
|
+
5. Check CSS is being generated:
|
|
378
|
+
```bash
|
|
379
|
+
# Look for generated CSS in output
|
|
380
|
+
npm run build
|
|
381
|
+
# Check build/ directory for CSS files
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**Prevention:**
|
|
385
|
+
- Use consistent color naming
|
|
386
|
+
- Document your color palette
|
|
387
|
+
- Test color changes immediately
|
|
388
|
+
- Use browser dev tools to inspect applied styles
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
### Problem: Icons from FontAwesome don't appear
|
|
393
|
+
|
|
394
|
+
**Symptoms:**
|
|
395
|
+
- Icon elements show empty squares or broken images
|
|
396
|
+
- FontAwesome classes render as text instead of icons
|
|
397
|
+
- Icons appear in some places but not others
|
|
398
|
+
|
|
399
|
+
**Solution:**
|
|
400
|
+
1. Verify FontAwesome is installed:
|
|
401
|
+
```bash
|
|
402
|
+
npm list @fortawesome/fontawesome-free
|
|
403
|
+
# Should show installed version
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
2. Check FontAwesome CSS is imported in `src/app.css`:
|
|
407
|
+
```css
|
|
408
|
+
@import '@fortawesome/fontawesome-free/css/all.css';
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
3. Verify icon classes are correct format:
|
|
412
|
+
```svelte
|
|
413
|
+
<!-- Correct formats: -->
|
|
414
|
+
<i class="fa-solid fa-home"></i>
|
|
415
|
+
<i class="fa-regular fa-user"></i>
|
|
416
|
+
<i class="fa-brands fa-github"></i>
|
|
417
|
+
|
|
418
|
+
<!-- Incorrect: -->
|
|
419
|
+
<i class="fa-home"></i> <!-- Missing weight class -->
|
|
420
|
+
<i class="home"></i> <!-- Not FontAwesome -->
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
4. Check icon exists in free version:
|
|
424
|
+
```bash
|
|
425
|
+
# Some icons require pro version
|
|
426
|
+
# Use free alternatives: https://fontawesome.com/icons
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
5. Build and verify:
|
|
430
|
+
```bash
|
|
431
|
+
npm run build
|
|
432
|
+
# Check if CSS includes FontAwesome styles
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
**Prevention:**
|
|
436
|
+
- Use official FontAwesome icon list
|
|
437
|
+
- Test new icons immediately
|
|
438
|
+
- Use consistent icon naming (fa-solid, fa-regular, etc.)
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## Performance Issues
|
|
443
|
+
|
|
444
|
+
### Problem: Documentation site is slow to load
|
|
445
|
+
|
|
446
|
+
**Symptoms:**
|
|
447
|
+
- First load takes more than 3 seconds
|
|
448
|
+
- Page transitions are laggy
|
|
449
|
+
- Build takes over 30 seconds
|
|
450
|
+
|
|
451
|
+
**Solution:**
|
|
452
|
+
1. Check build time:
|
|
453
|
+
```bash
|
|
454
|
+
time npm run build
|
|
455
|
+
# Should complete in under 30 seconds
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
2. Identify slow components:
|
|
459
|
+
```bash
|
|
460
|
+
npm run build -- --verbose
|
|
461
|
+
# Look for files taking longest to build
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
3. Optimize Tailwind CSS:
|
|
465
|
+
```typescript
|
|
466
|
+
// tailwind.config.ts - Limit which files to scan
|
|
467
|
+
export default {
|
|
468
|
+
content: ['./src/**/*.{html,js,svelte,ts}'],
|
|
469
|
+
// DON'T include: ./docs/**/* (not needed at build time)
|
|
470
|
+
};
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
4. Use dynamic imports for heavy components:
|
|
474
|
+
```svelte
|
|
475
|
+
<script lang="ts">
|
|
476
|
+
import { browser } from '$app/environment';
|
|
477
|
+
let HeavyComponent: any;
|
|
478
|
+
|
|
479
|
+
if (browser) {
|
|
480
|
+
import('./HeavyComponent.svelte').then(m => {
|
|
481
|
+
HeavyComponent = m.default;
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
</script>
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
5. Check for large images in docs:
|
|
488
|
+
```bash
|
|
489
|
+
find docs -type f -name "*.png" -o -name "*.jpg"
|
|
490
|
+
# Optimize images if over 100KB
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
6. Enable caching in production:
|
|
494
|
+
```typescript
|
|
495
|
+
// svelte.config.js
|
|
496
|
+
export default {
|
|
497
|
+
kit: {
|
|
498
|
+
cacheControl: {
|
|
499
|
+
maxage: 60 * 60 * 24 * 365,
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
};
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**Prevention:**
|
|
506
|
+
- Monitor build times regularly
|
|
507
|
+
- Optimize images before adding
|
|
508
|
+
- Use lazy loading for images
|
|
509
|
+
- Minimize external dependencies
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
### Problem: Search is slow or doesn't find results
|
|
514
|
+
|
|
515
|
+
**Symptoms:**
|
|
516
|
+
- Search takes more than 1 second to respond
|
|
517
|
+
- Searching doesn't return expected results
|
|
518
|
+
- Search index seems out of date
|
|
519
|
+
|
|
520
|
+
**Solution:**
|
|
521
|
+
1. Rebuild search index:
|
|
522
|
+
```bash
|
|
523
|
+
npm run build
|
|
524
|
+
# This regenerates Pagefind index
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
2. Check Pagefind configuration:
|
|
528
|
+
```toml
|
|
529
|
+
# pagefind.toml
|
|
530
|
+
[build]
|
|
531
|
+
source = "build" # Correct directory
|
|
532
|
+
output_subdir = "_pagefind"
|
|
533
|
+
|
|
534
|
+
[index]
|
|
535
|
+
relative_urls = true
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
3. Verify search files are generated:
|
|
539
|
+
```bash
|
|
540
|
+
ls -la build/_pagefind/
|
|
541
|
+
# Should show: chunk.html, index.html, etc.
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
4. Check if pages are indexed:
|
|
545
|
+
```bash
|
|
546
|
+
# Look for index summary during build
|
|
547
|
+
npm run build 2>&1 | grep -i "pages indexed"
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
5. Clear and rebuild:
|
|
551
|
+
```bash
|
|
552
|
+
rm -rf build
|
|
553
|
+
npm run build
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
**Prevention:**
|
|
557
|
+
- Run `npm run build` before deploying
|
|
558
|
+
- Test search functionality after adding docs
|
|
559
|
+
- Monitor search performance in production
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
## Deployment Issues
|
|
564
|
+
|
|
565
|
+
### Problem: Documentation not accessible after deployment
|
|
566
|
+
|
|
567
|
+
**Symptoms:**
|
|
568
|
+
- Works locally with `npm run dev`
|
|
569
|
+
- Fails after deploying to Vercel, Netlify, etc.
|
|
570
|
+
- 404 errors in production
|
|
571
|
+
|
|
572
|
+
**Solution:**
|
|
573
|
+
1. Verify build succeeds:
|
|
574
|
+
```bash
|
|
575
|
+
npm run build
|
|
576
|
+
npm run preview
|
|
577
|
+
# Should work like production
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
2. Check adapter is configured for your deployment:
|
|
581
|
+
```typescript
|
|
582
|
+
// svelte.config.js - for static sites
|
|
583
|
+
import adapter from '@sveltejs/adapter-static';
|
|
584
|
+
|
|
585
|
+
export default {
|
|
586
|
+
kit: {
|
|
587
|
+
adapter: adapter({
|
|
588
|
+
pages: 'build',
|
|
589
|
+
assets: 'build',
|
|
590
|
+
fallback: 'index.html',
|
|
591
|
+
precompress: false,
|
|
592
|
+
}),
|
|
593
|
+
},
|
|
594
|
+
};
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
3. For Vercel:
|
|
598
|
+
```bash
|
|
599
|
+
vercel --prod
|
|
600
|
+
# Check logs: vercel logs --follow
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
4. For Netlify:
|
|
604
|
+
```bash
|
|
605
|
+
netlify deploy --prod --dir=build
|
|
606
|
+
# Check: netlify status
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
5. Verify environment variables:
|
|
610
|
+
```bash
|
|
611
|
+
# Deployment platform should have no special env vars needed
|
|
612
|
+
# If errors, check platform logs
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
6. Check deployment logs for errors:
|
|
616
|
+
- Vercel: https://vercel.com/dashboard
|
|
617
|
+
- Netlify: https://app.netlify.com
|
|
618
|
+
- GitHub Pages: Actions tab
|
|
619
|
+
|
|
620
|
+
**Prevention:**
|
|
621
|
+
- Test production build locally first
|
|
622
|
+
- Use `npm run preview` to verify
|
|
623
|
+
- Keep adapter configuration in version control
|
|
624
|
+
- Test deployment on staging environment
|
|
625
|
+
|
|
626
|
+
---
|
|
627
|
+
|
|
628
|
+
## Common Errors & Solutions
|
|
629
|
+
|
|
630
|
+
| Error | Cause | Solution |
|
|
631
|
+
|-------|-------|----------|
|
|
632
|
+
| **Module not found** | Missing node_modules | Run `npm install` |
|
|
633
|
+
| **ENOENT: no such file** | File/folder doesn't exist | Create missing file/folder |
|
|
634
|
+
| **Port 5173 in use** | Another process using port | Change port: `npm run dev -- --port 3000` |
|
|
635
|
+
| **CSS not loading** | Tailwind not compiled | Run `npm run dev` from project root |
|
|
636
|
+
| **Routes not found** | File structure incorrect | Ensure `src/routes/docs/` exists |
|
|
637
|
+
| **Props error** | Component props mismatch | Check TypeScript types |
|
|
638
|
+
| **Dark mode not persisting** | localStorage not working | Ensure `theme` store initializes |
|
|
639
|
+
| **Images not loading** | Wrong path or 404 | Use absolute paths: `/images/name.png` |
|
|
640
|
+
| **Search not working** | Index not generated | Run `npm run build` |
|
|
641
|
+
| **Sidebar not responsive** | CSS not applied | Clear cache and restart dev server |
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
## Getting More Help
|
|
646
|
+
|
|
647
|
+
If you can't find the solution:
|
|
648
|
+
|
|
649
|
+
1. **Check the logs:**
|
|
650
|
+
```bash
|
|
651
|
+
# See detailed error messages
|
|
652
|
+
npm run dev -- --verbose
|
|
653
|
+
npm run build -- --verbose
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
2. **Check browser console:**
|
|
657
|
+
- Open DevTools (F12)
|
|
658
|
+
- Go to Console tab
|
|
659
|
+
- Look for red error messages
|
|
660
|
+
|
|
661
|
+
3. **Check browser Network tab:**
|
|
662
|
+
- Open DevTools (F12)
|
|
663
|
+
- Go to Network tab
|
|
664
|
+
- Look for failed requests (red)
|
|
665
|
+
|
|
666
|
+
4. **Common debugging:**
|
|
667
|
+
```javascript
|
|
668
|
+
// In browser console:
|
|
669
|
+
console.log(localStorage.getItem('theme')); // Check theme
|
|
670
|
+
console.log(document.documentElement.className); // Check classes
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
5. **Create minimal reproduction:**
|
|
674
|
+
- Remove custom code
|
|
675
|
+
- Test with default setup
|
|
676
|
+
- Add features one by one
|
|
677
|
+
|
|
678
|
+
6. **Check documentation:**
|
|
679
|
+
- [SvelteKit Docs](https://kit.svelte.dev)
|
|
680
|
+
- [Svelte 5 Docs](https://svelte.dev)
|
|
681
|
+
- [Tailwind CSS Docs](https://tailwindcss.com)
|
|
682
|
+
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
## Still Stuck?
|
|
686
|
+
|
|
687
|
+
If none of these solutions work:
|
|
688
|
+
|
|
689
|
+
1. **Document the issue:**
|
|
690
|
+
- What you were trying to do
|
|
691
|
+
- Exact error message(s)
|
|
692
|
+
- Steps to reproduce
|
|
693
|
+
- Your environment (Node version, OS, etc.)
|
|
694
|
+
|
|
695
|
+
2. **Check GitHub issues:**
|
|
696
|
+
- Search existing issues
|
|
697
|
+
- Create new issue with details
|
|
698
|
+
|
|
699
|
+
3. **Ask in community:**
|
|
700
|
+
- Svelte Discord: https://discord.gg/svelte
|
|
701
|
+
- SvelteKit Discussions: GitHub Discussions
|
|
702
|
+
- Stack Overflow with `svelte` tag
|
|
703
|
+
|
|
704
|
+
Good luck! 🚀
|