Skip to content

Files

Latest commit

 

History

History
37 lines (24 loc) · 1.29 KB

LEARNINGS.md

File metadata and controls

37 lines (24 loc) · 1.29 KB

Learnings

Here's a list of my learnings while building this website.

Svelte / SvelteKit

  • Add PostCSS with svelte-preprocess
  • Use dynamic + static classes: class="icon {svg}"
  • How to log a reactive variable each time it changes: $: foo, console.log('value:', foo);
  • How to update a variable from the store: `customBackground.set('#000')``

TypeScript

  • 🎉 How do I type reactive assignments? / I get an "implicitly has type 'any' error"? source
let show: boolean // <--- added above the reactive assignment
$: show = !!data.someKey // <-- `show` now has type `boolean`

CSS

  • How to prevent CSS transition from happening on 1st render.

HTML/Accessibility

VSCode

  • 🎉 Source: Install the "Svelte for VS Code" extension and add this in your VSCode settings to enable formatting:
"[svelte]": {
  "editor.defaultFormatter": "svelte.svelte-vscode"
   },