-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#27): sveltekit route is not always defined
- Loading branch information
Showing
33 changed files
with
800 additions
and
14,498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,17 @@ | ||
# create-svelte | ||
# Sveltekit Demo application for Vercel Speed-insights | ||
|
||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). | ||
## Setup | ||
|
||
## Creating a project | ||
This application was created with the following commands: | ||
|
||
If you're seeing this, you've probably already done this step. Congrats! | ||
- `cd apps` | ||
- `pnpm create svelte@latest sveltekit` (answers: Skeleton project, JavaScript with JSDoc, no additional option) | ||
- `cd sveltekit` | ||
- add `src/+layout.js` to include `import { injectSpeedInsights } from '@vercel/speed-insights/sveltekit'; injectSpeedInsights();` | ||
- edit package.json to add `"@vercel/speed-insights": "workspace:*"` dependency and change `@sveltejs/adapter-auto` into `@sveltejs/adapter-vercel` | ||
- eddi `svelte.config.js` to change `@sveltejs/adapter-auto` into `@sveltejs/adapter-vercel` | ||
- `pnpm i` | ||
|
||
```bash | ||
# create a new project in the current directory | ||
npm create svelte@latest | ||
## Usage | ||
|
||
# create a new project in my-app | ||
npm create svelte@latest my-app | ||
``` | ||
|
||
## 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 | ||
|
||
To create a production version of your app: | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
You can preview the production build with `npm run preview`. | ||
|
||
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. | ||
Start it with `cd apps/sveltekit` + `pnpm dev` and browse to [http://localhost:5173](http://localhost:5173) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { injectSpeedInsights } from '@vercel/speed-insights/sveltekit'; | ||
|
||
injectSpeedInsights(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,2 @@ | ||
<script> | ||
import Counter from './Counter.svelte'; | ||
import welcome from '$lib/images/svelte-welcome.webp'; | ||
import welcome_fallback from '$lib/images/svelte-welcome.png'; | ||
</script> | ||
|
||
<svelte:head> | ||
<title>Home</title> | ||
<meta name="description" content="Svelte demo app" /> | ||
</svelte:head> | ||
|
||
<section> | ||
<h1> | ||
<span class="welcome"> | ||
<picture> | ||
<source srcset={welcome} type="image/webp" /> | ||
<img src={welcome_fallback} alt="Welcome" /> | ||
</picture> | ||
</span> | ||
|
||
to your new<br />SvelteKit app | ||
</h1> | ||
|
||
<h2> | ||
try editing <strong>src/routes/+page.svelte</strong> | ||
</h2> | ||
|
||
<Counter /> | ||
</section> | ||
|
||
<style> | ||
section { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
flex: 0.6; | ||
} | ||
h1 { | ||
width: 100%; | ||
} | ||
.welcome { | ||
display: block; | ||
position: relative; | ||
width: 100%; | ||
height: 0; | ||
padding: 0 0 calc(100% * 495 / 2048) 0; | ||
} | ||
.welcome img { | ||
position: absolute; | ||
width: 100%; | ||
height: 100%; | ||
top: 0; | ||
display: block; | ||
} | ||
</style> | ||
<h1>Welcome to SvelteKit</h1> | ||
<p>Visit <a href="/bruno">this page</a> to know more...</p> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.