Skip to content

Commit e035311

Browse files
Sync kit docs (#1435)
sync kit docs Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com>
1 parent b932b92 commit e035311

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

apps/svelte.dev/content/docs/kit/10-getting-started/20-creating-a-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Creating a project
55

66
The easiest way to start building a SvelteKit app is to run `npx sv create`:
77

8-
```bash
8+
```sh
99
npx sv create my-app
1010
cd my-app
1111
npm install

apps/svelte.dev/content/docs/kit/20-core-concepts/40-page-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Since these routes cannot be dynamically server-rendered, this will cause errors
8989

9090
SvelteKit will discover pages to prerender automatically, by starting at _entry points_ and crawling them. By default, all your non-dynamic routes are considered entry points — for example, if you have these routes...
9191

92-
```bash
92+
```sh
9393
/ # non-dynamic
9494
/blog # non-dynamic
9595
/blog/[slug] # dynamic, because of `[slug]`

apps/svelte.dev/content/docs/kit/25-build-and-deploy/40-adapter-node.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ First, build your app with `npm run build`. This will create the production serv
2727

2828
You will need the output directory, the project's `package.json`, and the production dependencies in `node_modules` to run the application. Production dependencies can be generated by copying the `package.json` and `package-lock.json` and then running `npm ci --omit dev` (you can skip this step if your app doesn't have any dependencies). You can then start your app with this command:
2929

30-
```bash
30+
```sh
3131
node build
3232
```
3333

@@ -45,41 +45,41 @@ In `dev` and `preview`, SvelteKit will read environment variables from your `.en
4545

4646
In production, `.env` files are _not_ automatically loaded. To do so, install `dotenv` in your project...
4747

48-
```bash
48+
```sh
4949
npm install dotenv
5050
```
5151

5252
...and invoke it before running the built app:
5353

54-
```bash
54+
```sh
5555
node +++-r dotenv/config+++ build
5656
```
5757

5858
If you use Node.js v20.6+, you can use the [`--env-file`](https://nodejs.org/en/learn/command-line/how-to-read-environment-variables-from-nodejs) flag instead:
5959

60-
```bash
60+
```sh
6161
node +++--env-file=.env+++ build
6262
```
6363

6464
### `PORT`, `HOST` and `SOCKET_PATH`
6565

6666
By default, the server will accept connections on `0.0.0.0` using port 3000. These can be customised with the `PORT` and `HOST` environment variables:
6767

68-
```bash
68+
```sh
6969
HOST=127.0.0.1 PORT=4000 node build
7070
```
7171

7272
Alternatively, the server can be configured to accept connections on a specified socket path. When this is done using the `SOCKET_PATH` environment variable, the `HOST` and `PORT` environment variables will be disregarded.
7373

74-
```bash
74+
```sh
7575
SOCKET_PATH=/tmp/socket node build
7676
```
7777

7878
### `ORIGIN`, `PROTOCOL_HEADER`, `HOST_HEADER`, and `PORT_HEADER`
7979

8080
HTTP doesn't give SvelteKit a reliable way to know the URL that is currently being requested. The simplest way to tell SvelteKit where the app is being served is to set the `ORIGIN` environment variable:
8181

82-
```bash
82+
```sh
8383
ORIGIN=https://my.site node build
8484

8585
# or e.g. for local previewing and testing
@@ -88,7 +88,7 @@ ORIGIN=http://localhost:3000 node build
8888

8989
With this, a request for the `/stuff` pathname will correctly resolve to `https://my.site/stuff`. Alternatively, you can specify headers that tell SvelteKit about the request protocol and host, from which it can construct the origin URL:
9090

91-
```bash
91+
```sh
9292
PROTOCOL_HEADER=x-forwarded-proto HOST_HEADER=x-forwarded-host node build
9393
```
9494

@@ -104,7 +104,7 @@ If `adapter-node` can't correctly determine the URL of your deployment, you may
104104

105105
The [`RequestEvent`](@sveltejs-kit#RequestEvent) object passed to hooks and endpoints includes an `event.getClientAddress()` function that returns the client's IP address. By default this is the connecting `remoteAddress`. If your server is behind one or more proxies (such as a load balancer), this value will contain the innermost proxy's IP address rather than the client's, so we need to specify an `ADDRESS_HEADER` to read the address from:
106106

107-
```bash
107+
```sh
108108
ADDRESS_HEADER=True-Client-IP node build
109109
```
110110

@@ -175,7 +175,7 @@ If you need to change the name of the environment variables used to configure th
175175
envPrefix: 'MY_CUSTOM_';
176176
```
177177

178-
```bash
178+
```sh
179179
MY_CUSTOM_HOST=127.0.0.1 \
180180
MY_CUSTOM_PORT=4000 \
181181
MY_CUSTOM_ORIGIN=https://my.site \

apps/svelte.dev/content/docs/kit/25-build-and-deploy/70-adapter-cloudflare-workers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ https://dash.cloudflare.com/<your-account-id>/home
6565
6666
You will need to install [Wrangler](https://developers.cloudflare.com/workers/wrangler/install-and-update/) and log in, if you haven't already:
6767

68-
```bash
68+
```sh
6969
npm i -D wrangler
7070
wrangler login
7171
```
7272

7373
Then, you can build your app and deploy it:
7474

75-
```bash
75+
```sh
7676
wrangler deploy
7777
```
7878

apps/svelte.dev/content/docs/kit/25-build-and-deploy/90-adapter-vercel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Set this string as an environment variable on Vercel by logging in and going to
132132

133133
To get this key known about for local development, you can use the [Vercel CLI](https://vercel.com/docs/cli/env) by running the `vercel env pull` command locally like so:
134134

135-
```bash
135+
```sh
136136
vercel env pull .env.development.local
137137
```
138138

apps/svelte.dev/content/docs/kit/30-advanced/10-advanced-routing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Advanced routing
77

88
If the number of route segments is unknown, you can use rest syntax — for example you might implement GitHub's file viewer like so...
99

10-
```bash
10+
```sh
1111
/[org]/[repo]/tree/[branch]/[...file]
1212
```
1313

@@ -102,7 +102,7 @@ Each module in the `params` directory corresponds to a matcher, with the excepti
102102

103103
It's possible for multiple routes to match a given path. For example each of these routes would match `/foo-abc`:
104104

105-
```bash
105+
```sh
106106
src/routes/[...catchall]/+page.svelte
107107
src/routes/[[a=x]]/+page.svelte
108108
src/routes/[b]/+page.svelte
@@ -119,7 +119,7 @@ SvelteKit needs to know which route is being requested. To do so, it sorts them
119119

120120
...resulting in this ordering, meaning that `/foo-abc` will invoke `src/routes/foo-abc/+page.svelte`, and `/foo-def` will invoke `src/routes/foo-[c]/+page.svelte` rather than less specific routes:
121121

122-
```bash
122+
```sh
123123
src/routes/foo-abc/+page.svelte
124124
src/routes/foo-[c]/+page.svelte
125125
src/routes/[[a=x]]/+page.svelte

apps/svelte.dev/content/docs/kit/30-advanced/70-packaging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ You can create so-called declaration maps (`d.ts.map` files) by setting `"declar
250250

251251
To publish the generated package:
252252

253-
```bash
253+
```sh
254254
npm publish
255255
```
256256

apps/svelte.dev/content/docs/kit/40-best-practices/07-images.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Doing this manually is tedious. There are a variety of techniques you can use, d
3333

3434
Install:
3535

36-
```bash
36+
```sh
3737
npm install --save-dev @sveltejs/enhanced-img
3838
```
3939

apps/svelte.dev/content/docs/kit/60-appendix/10-faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ Currently ESM Support within the latest Yarn (version 3) is considered [experime
196196

197197
The below seems to work although your results may vary. First create a new application:
198198

199-
```bash
199+
```sh
200200
yarn create svelte myapp
201201
cd myapp
202202
```
203203

204204
And enable Yarn Berry:
205205

206-
```bash
206+
```sh
207207
yarn set version berry
208208
yarn install
209209
```

apps/svelte.dev/content/docs/kit/98-reference/25-$env-static-private.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ MY_FEATURE_FLAG=""
1919

2020
You can override `.env` values from the command line like so:
2121

22-
```bash
22+
```sh
2323
MY_FEATURE_FLAG="enabled" npm run dev
2424
```
2525

0 commit comments

Comments
 (0)