Svelte Guide
To create a new project based on this template using degit:
npx degit sveltejs/template NAME_OF_YOUR_PROJECT
cd NAME_OF_YOUR_PROJECT
Get started
Install the dependencies from inside/your/project_folder
cd inside/your/project_folder
npm i
Start Rollup:
npm run dev
Navigate to localhost:8080 to see your app running.
By default, the server will only respond to requests from localhost
.
To allow connections from other computers, edit the sirv
commands in package.json
to include the option --host 0.0.0.0
.
If your project does not need to be accessed from other computers whilst developing, there is no need to add --host
to your package.json
file.
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:
npm run build
You can run the newly built app with npm run start
.
This uses sirv, which is included in your package.json's dependencies
so that the app will work when deployed to Vercel.
Updating CSS
Whenever you make global changes to the CSS you will need to run the following command:
npm rum prepare
For this project we are using Svelte Material-UI components and styling, so whilst developing, if changes are made to the src/theme/_smui-theme.scss
or src/theme/dark/_smui-theme.scss
files, npm run prepare
needs to be run before any of your changes will be seen on your localhost:8080
.