You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.5 KiB
45 lines
1.5 KiB
3 years ago
|
# SvelteKit
|
||
|
|
||
|
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte), deployed to [Vercel](https://vercel.com).
|
||
|
|
||
|
## Deploy Your Own
|
||
|
|
||
|
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fvercel%2Ftree%2Fmain%2Fexamples%2Fsveltekit&project-name=sveltekit-vercel&repository-name=sveltekit-vercel&demo-title=SvelteKit%20%2B%20Vercel&demo-description=A%20SvelteKit%20app%20optimized%20Edge-first.&demo-url=https%3A%2F%2Fsveltekit-template.vercel.app%2F)
|
||
|
|
||
|
_Live Example: https://sveltekit-template.vercel.app_
|
||
|
|
||
|
## Creating a project
|
||
|
|
||
|
If you're seeing this, you've probably already done this step. Congrats!
|
||
|
|
||
|
```bash
|
||
|
# create a new project in the current directory
|
||
|
npm init svelte@next
|
||
|
|
||
|
# create a new project in my-app
|
||
|
npm init svelte@next my-app
|
||
|
```
|
||
|
|
||
|
> Note: the `@next` is temporary
|
||
|
|
||
|
## Developing
|
||
|
|
||
|
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||
|
|
||
|
```bash
|
||
|
npm run dev
|
||
|
|
||
|
# or start the server and open the app in a new browser tab
|
||
|
npm run dev -- --open
|
||
|
```
|
||
|
|
||
|
## Building
|
||
|
|
||
|
This uses the adapter-auto for SvelteKit, which detects Vercel and runs adapter-vercel on your behalf.
|
||
|
|
||
|
```bash
|
||
|
npm run build
|
||
|
```
|
||
|
|
||
|
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|