DEV Community

Cover image for Day 03: Trying Svelte and Breaking the Blog (almost πŸ˜…)
Sourav Yadav
Sourav Yadav

Posted on

Day 03: Trying Svelte and Breaking the Blog (almost πŸ˜…)

Hey devs! πŸ‘‹

Today was all about Svelte, components, and my first real attempt at client-side routing β€” and wow, things got tricky fast!

🧠 Goal for Today

  • Integrate Svelte into my existing blog structure.
  • Break repetitive HTML into modular components like Navbar.svelte, Post.svelte.
  • Try using svelte-spa-router for page routing.

🧩 The Problems I Faced

I used bun create vite svelteapp --template svelte to set things up.

Moved my old index.html, about.html, and posts.html into the public/ folder β€” Svelte was rendering fine.

Created components, and even App.svelte was showing up nicely.

But then…

Routing broke everything. ☠️

I added svelte-spa-router using:

bun add svelte-spa-router

…but couldn’t get the components to load on navigation. I think it has to do with the URL hash (#) not being detected. Still debugging this.

πŸ’‘ What I Learned

  • Svelte is super clean. Definitely loving the syntax and reactivity.
  • I’m using bunx live-server to serve files. It installs into ~/.bun/install/cache/ β€” a good thing to clean up later!
  • Learned to separate components properly, though I still need to figure out how to handle per-post pages (day01.html, etc.).
  • Vite + Bun combo is fast and neat!

Still hacking at this. Routing is tricky β€” but I’m getting there!

Follow my dev journey β€” if you're also learning, feel free to reach out! πŸ™Œ

x.com/coding_theself

linkedin.com/in/sourav-yadav-self

Also, Special Thanks to @csm18 for suggesting me to use svelte

Check out the Live Blog: https://codingtheself.github.io/webdevblog/posts/day03.html

πŸ“Έ Sneak Peek

Trying to Integrate svelte-spa-router but not working

Top comments (0)