svelte-template Svelte Themes

Svelte Template

This is my personal project template for Svelte apps

@idleberg/svelte-template

This is my personal project template for Svelte apps. It lives at https://github.com/idleberg/svelte-template.

This template differs from the official template in the following aspects:

  • TypeScript by default
  • uses pnpm for package management
  • uses vite for building and as development server
  • generates components with plop
  • incorporates eslint and stylelint
  • supports aliases for $components, $lib, $stores and $workers

To create a new project based on this template using degit:

npx degit idleberg/svelte-template svelte-app
cd svelte-app

Note that you will need to have Node.js installed.

Get started

Install the dependencies...

cd svelte-app
pnpm install

...then start Vite:

pnpm run dev

Navigate to localhost:3000. You should see your app running. Edit a component file in src, save it, and reload the page to see your changes.

If you're using Visual Studio Code we recommend installing the official extension Svelte for VS Code. If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense.

Building and running in production mode

To create an optimised version of the app:

pnpm run build

You can run the newly built app with pnpm run start. This uses Vite, which is included in your package.json's dependencies so that the app will work when you deploy to platforms like Heroku.

Deploying to the web

With Vercel

Install vercel if you haven't already:

pnpm install -g vercel

Then, from within your project folder:

cd public
vercel deploy --name my-project

With surge

Install surge if you haven't already:

pnpm install -g surge

Then, from within your project folder:

pnpm run build
surge public my-project.surge.sh

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes