Skip to content

Commit 883ef5b

Browse files
committed
minor changes
delete sverdle/
1 parent 39665b7 commit 883ef5b

File tree

10 files changed

+27
-13673
lines changed

10 files changed

+27
-13673
lines changed

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
![image](static/snap.png)
22

3-
![Static Badge](https://img.shields.io/badge/sveltekit-v2%2e0%2e0-f96743) ![Static Badge](https://img.shields.io/badge/tailwindcss-v3%2e4%2e7-38bdf8)
4-
![image](static/snap.png)
5-
63
![Static Badge](https://img.shields.io/badge/sveltekit-v2%2e0%2e0-f96743) ![Static Badge](https://img.shields.io/badge/tailwindcss-v3%2e4%2e7-38bdf8)
74

85
"[Svelte](https://svelte.dev/) is a tool for building web applications. Like other user interface frameworks, it allows you to build your app _declaratively_ out of components that combine markup, styles, and behaviours."
@@ -21,7 +18,7 @@ This guide provides a first-hand experience on building a Svelte project using [
2118
cd project_name
2219
```
2320

24-
**2. Install Tailwind CSS and sveltekit static adapter.** <small>[reference here](https://kit.svelte.dev/docs/adapter-static)</small>
21+
**2. Install Tailwind CSS and `sveltekit static adapter`.**
2522

2623
```bash
2724
# terminal
@@ -30,7 +27,7 @@ This guide provides a first-hand experience on building a Svelte project using [
3027
npx tailwindcss init -p
3128
```
3229

33-
**3. Enable use of PostCSS in \<style> blocks.** <small>[reference here](https://tailwindcss.com/docs/guides/sveltekit)</small>
30+
**3. Configure `svelte config`.**
3431

3532
```js
3633
// svelte.config.js
@@ -40,14 +37,29 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
4037
/** @type {import('@sveltejs/kit').Config} */
4138
const config = {
4239
kit: {
43-
adapter: adapter()
40+
adapter: adapter(),
41+
paths: {
42+
base: process.env.NODE_ENV === 'production' ? '/sveltekit' : ''
43+
}
4444
},
4545
preprocess: vitePreprocess()
4646
};
4747

4848
export default config;
4949
```
5050

51+
> [!NOTE]
52+
>
53+
> Now you can add relative **base** paths for your routing like [this](src/routes/Header.svelte).
54+
55+
```js
56+
<script>import {base} from '$app/paths'</script>
57+
58+
<a href="{base}/about">About</a>
59+
```
60+
61+
For the modules (e.g. `$app/paths`), check the [official documentation](https://kit.svelte.dev/docs/modules).
62+
5163
**4. Configure your template paths.**
5264

5365
```js
@@ -85,7 +97,6 @@ export default {
8597
**7. Start your build process.**
8698

8799
```bash
88-
# terminal
89100
# terminal
90101
npm run dev
91102
```
@@ -162,7 +173,7 @@ npm install gh-pages --save-dev
162173
```json
163174
{
164175
"scripts": {
165-
"deploy": "npm run build && gh-pages -d build"
176+
"deploy": "npm run build && gh-pages -d build -t true"
166177
}
167178
}
168179
```

src/routes/+page.svelte

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import Counter from './Counter.svelte';
33
// import welcome from '$lib/images/svelte-welcome.webp';
44
// import welcome_fallback from '$lib/images/svelte-welcome.png';
5-
import welcome from '../lib/images/svelte-welcome.png';
5+
import welcome from '$lib/images/svelte-welcome.png';
66
</script>
77

88
<svelte:head>
@@ -11,12 +11,9 @@
1111

1212
<section>
1313
<h1>
14-
<img src={welcome} alt="Welcome" />
15-
<!-- <span class="welcome"> -->
16-
<!-- <picture>
17-
<source srcset={welcome} type="image/webp" />
18-
</picture> -->
19-
<!-- </span> -->
14+
<span class="welcome">
15+
<img src={welcome} alt="Welcome" />
16+
</span>
2017

2118
to your new<br /> <span class="text-orange-600 font-bold">SvelteKit</span> app
2219
</h1>
@@ -41,7 +38,7 @@
4138
width: 100%;
4239
}
4340
44-
/* .welcome {
41+
.welcome {
4542
display: block;
4643
position: relative;
4744
width: 100%;
@@ -55,5 +52,5 @@
5552
height: 100%;
5653
top: 0;
5754
display: block;
58-
} */
55+
}
5956
</style>

src/routes/Header.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
<path d="M0,0 L1,2 C1.5,3 1.5,3 2,3 L2,0 Z" />
1818
</svg>
1919
<ul>
20-
<li aria-current={$page.url.pathname === '/' ? 'page' : undefined}>
20+
<li aria-current={$page.url.pathname === `${base}/` ? 'page' : undefined}>
2121
<a href="{base}/">Home</a>
2222
</li>
23-
<li aria-current={$page.url.pathname === '/about' ? 'page' : undefined}>
23+
<li aria-current={$page.url.pathname === `${base}/about` ? 'page' : undefined}>
2424
<a href="{base}/about">About</a>
2525
</li>
2626
</ul>

src/routes/sverdle/+page.server.js

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy