Skip to content

Commit dc451ff

Browse files
authored
docs: make SvelteKit/Vite config examples more concise (#225)
* chore(examples): bump deps * docs: brevity and capitalization * docs: only use one example
1 parent d686647 commit dc451ff

File tree

20 files changed

+80
-93
lines changed

20 files changed

+80
-93
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5050

5151
## [5.3.2](https://github.com/metonym/svelte-highlight/releases/tag/v5.3.2) - 2022-03-16
5252

53-
- specify in docs that vite should optimize both "highlight.js" and "highlight.js/lib/core" if using SvelteKit or vite
53+
- specify in docs that Vite should optimize both "highlight.js" and "highlight.js/lib/core" if using SvelteKit or Vite
5454

5555
## [5.3.1](https://github.com/metonym/svelte-highlight/releases/tag/v5.3.1) - 2022-03-16
5656

README.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,50 +26,28 @@ Note that [pnpm](https://github.com/pnpm/pnpm) users must also install `highligh
2626

2727
## SvelteKit Set-up
2828

29-
To use this library with [SvelteKit](https://github.com/sveltejs/kit) or [vite](https://github.com/sveltejs/vite-plugin-svelte), instruct vite to optimize `highlight.js` and `highlight.js/lib/core`:
29+
To use this library with [SvelteKit](https://github.com/sveltejs/kit) or [Vite](https://github.com/sveltejs/vite-plugin-svelte), instruct Vite to [optimize](https://vitejs.dev/config/dep-optimization-options.html#optimizedeps-include) `highlight.js` and `highlight.js/lib/core`:
3030

3131
```diff
3232
+ optimizeDeps: {
3333
+ include: ["highlight.js", "highlight.js/lib/core"],
3434
+ },
3535
```
3636

37-
As of [SvelteKit version 1.0.0-next.359](https://github.com/sveltejs/kit/releases/tag/%40sveltejs/kit%401.0.0-next.359), `vite` options are defined in `vite.config.js`.
38-
3937
**vite.config.js**
4038

4139
```js
4240
import { sveltekit } from "@sveltejs/kit/vite";
4341

4442
/** @type {import('vite').UserConfig} */
45-
const config = {
43+
export default {
4644
plugins: [sveltekit()],
4745
optimizeDeps: {
4846
include: ["highlight.js", "highlight.js/lib/core"],
4947
},
5048
};
51-
52-
export default config;
53-
```
54-
55-
<details>
56-
<summary>SvelteKit <=1.0.0-next.358</summary>
57-
58-
```js
59-
// svelte.config.js
60-
export default {
61-
kit: {
62-
vite: {
63-
optimizeDeps: {
64-
include: ["highlight.js", "highlight.js/lib/core"],
65-
},
66-
},
67-
},
68-
};
6949
```
7050

71-
</details>
72-
7351
Refer to [examples/sveltekit](examples/sveltekit) or [examples/vite](examples/vite).
7452

7553
## Usage

demo/routes/index.svelte

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@
8080
<Row class="mb-7">
8181
<Column xlg={9} lg={12}>
8282
<p class="mb-5">
83-
To use this library with SvelteKit or vite, add <code class="code"
83+
To use this library with SvelteKit or Vite, add <code class="code"
8484
>"highlight.js"</code
8585
>
8686
and <code class="code">"highlight.js/lib/core"</code>
87-
to the dependencies for vite to optimize.
87+
to the dependencies for Vite to optimize.
8888
</p>
8989

9090
<h5 class="mb-5">vite.config.js</h5>
@@ -309,14 +309,15 @@
309309
<Column xlg={9} lg={12}>
310310
<h3 class="mb-7">Examples</h3>
311311
<p class="mb-5">
312-
Example set-ups – including SvelteKit, Rollup, Webpack, and Snowpack – are
313-
located in the
312+
Example set-ups – including SvelteKit, Vite, Rollup, Webpack, and Snowpack
313+
– are located in the
314314
<Link
315315
inline
316316
size="lg"
317317
href="https://github.com/metonym/svelte-highlight/tree/master/examples"
318-
>examples folder in the GitHub repository</Link
319-
>.
318+
>
319+
examples folder in the GitHub repository
320+
</Link>.
320321
</p>
321322
</Column>
322323
</Row>

examples/rollup-typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@rollup/plugin-node-resolve": "^13.3.0",
1111
"@rollup/plugin-typescript": "^8.3.3",
1212
"@tsconfig/svelte": "^3.0.0",
13-
"rollup": "^2.76.0",
13+
"rollup": "^2.77.0",
1414
"rollup-plugin-svelte": "^7.0.0",
1515
"rollup-plugin-terser": "^7.0.2",
1616
"svelte": "^3.49.0",

examples/rollup-typescript/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,10 @@ rollup-pluginutils@^2.8.2:
655655
dependencies:
656656
estree-walker "^0.6.1"
657657

658-
rollup@^2.76.0:
659-
version "2.76.0"
660-
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.76.0.tgz#c69fe03db530ac53fcb9523b3caa0d3c0b9491a1"
661-
integrity sha512-9jwRIEY1jOzKLj3nsY/yot41r19ITdQrhs+q3ggNWhr9TQgduHqANvPpS32RNpzGklJu3G1AJfvlZLi/6wFgWA==
658+
rollup@^2.77.0:
659+
version "2.77.0"
660+
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.77.0.tgz#749eaa5ac09b6baa52acc076bc46613eddfd53f4"
661+
integrity sha512-vL8xjY4yOQEw79DvyXLijhnhh+R/O9zpF/LEgkCebZFtb6ELeN9H3/2T0r8+mp+fFTBHZ5qGpOpW2ela2zRt3g==
662662
optionalDependencies:
663663
fsevents "~2.3.2"
664664

examples/rollup/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"devDependencies": {
88
"@rollup/plugin-commonjs": "^22.0.1",
99
"@rollup/plugin-node-resolve": "^13.3.0",
10-
"rollup": "^2.76.0",
10+
"rollup": "^2.77.0",
1111
"rollup-plugin-svelte": "^7.1.0",
1212
"rollup-plugin-terser": "^7.0.2",
1313
"svelte": "^3.49.0",

examples/rollup/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,10 @@ rollup-pluginutils@^2.8.2:
403403
dependencies:
404404
estree-walker "^0.6.1"
405405

406-
rollup@^2.76.0:
407-
version "2.76.0"
408-
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.76.0.tgz#c69fe03db530ac53fcb9523b3caa0d3c0b9491a1"
409-
integrity sha512-9jwRIEY1jOzKLj3nsY/yot41r19ITdQrhs+q3ggNWhr9TQgduHqANvPpS32RNpzGklJu3G1AJfvlZLi/6wFgWA==
406+
rollup@^2.77.0:
407+
version "2.77.0"
408+
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.77.0.tgz#749eaa5ac09b6baa52acc076bc46613eddfd53f4"
409+
integrity sha512-vL8xjY4yOQEw79DvyXLijhnhh+R/O9zpF/LEgkCebZFtb6ELeN9H3/2T0r8+mp+fFTBHZ5qGpOpW2ela2zRt3g==
410410
optionalDependencies:
411411
fsevents "~2.3.2"
412412

examples/snowpack/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# examples/snowpack
22

3-
> `svelte-highlight` snowpack set-up.
3+
> `svelte-highlight` Snowpack set-up.
44
55
## Available Scripts
66

examples/sveltekit/.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.DS_Store
22
node_modules
3-
/.svelte-kit
4-
/build
5-
/functions
3+
.svelte-kit
4+
build

examples/sveltekit/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ Runs the project in development mode and watches for any changes.
1111
### `yarn build`
1212

1313
Builds the project for production.
14+
15+
### `yarn preview`
16+
17+
Preview the app locally. Run `yarn build` first.

0 commit comments

Comments
 (0)