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:
pnpm
for package managementvite
for building and as development serverplop
eslint
and stylelint
$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.
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.
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.
Install vercel
if you haven't already:
pnpm install -g vercel
Then, from within your project folder:
cd public
vercel deploy --name my-project
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