Skip to content

Commit f32bf07

Browse files
delucissarah11918
andauthored
Improve Svelte README (#5923)
* First stylistic pass * Rework for x/o instead of and * fix typo Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Add changeset Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
1 parent f27bb3d commit f32bf07

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

.changeset/lucky-ants-push.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@astrojs/svelte": patch
3+
---
4+
5+
Improve README

packages/integrations/svelte/README.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ This package is maintained by Astro's Core team. You're welcome to submit an iss
7474

7575
## Options
7676

77-
This integration is powered by `@sveltejs/vite-plugin-svelte`. To customize the Svelte compiler, options can be provided to the integration. See the `@sveltejs/vite-plugin-svelte` [docs](https://github.com/sveltejs/vite-plugin-svelte/blob/HEAD/docs/config.md) for more details.
77+
This integration is powered by `@sveltejs/vite-plugin-svelte`. To customize the Svelte compiler, options can be provided to the integration. See the [`@sveltejs/vite-plugin-svelte` docs](https://github.com/sveltejs/vite-plugin-svelte/blob/HEAD/docs/config.md) for more details.
7878

7979
### Default options
8080

81-
A few of the default options passed to the Svelte compiler are required to build properly for Astro and cannot be overridden.
81+
This integration passes the following default options to the Svelte compiler:
8282

8383
```js
8484
const defaultOptions = {
@@ -88,40 +88,39 @@ const defaultOptions = {
8888
};
8989
```
9090

91-
The `emitCss`, `compilerOptions.dev`, and `compilerOptions.hydratable` cannot be overridden.
91+
These `emitCss`, `compilerOptions.dev`, and `compilerOptions.hydratable` values are required to build properly for Astro and cannot be overridden.
9292

93-
Providing your own `preprocess` options **will** override the defaults - make sure to enable the preprocessor flags needed for your project. For example,
93+
Providing your own `preprocess` options **will** override the [`vitePreprocess()`](https://github.com/sveltejs/vite-plugin-svelte/blob/HEAD/docs/preprocess.md) default. Make sure to enable the preprocessor flags needed for your project.
94+
95+
You can set options either by passing them to the `svelte` integration in `astro.config.mjs` or in `svelte.config.js`. Either of these would override the default `preprocess` setting:
9496

9597
```js
96-
// astro.config.js
98+
// astro.config.mjs
9799
import svelte from '@astrojs/svelte';
98100

99101
export default {
100102
integrations: [svelte({ preprocess: [] })],
101103
};
102104
```
103105

104-
and
105-
106106
```js
107107
// svelte.config.js
108108
export default {
109109
preprocess: [],
110110
};
111111
```
112112

113-
Will override the default `preprocess` option. You can read the [`vitePreprocess` docs](https://github.com/sveltejs/vite-plugin-svelte/blob/HEAD/docs/preprocess.md) for more information of how it works.
114-
115113
## Intellisense for TypeScript
116114

117-
If you're using a preprocessor like TypeScript or SCSS in your Svelte files, you can create a `svelte.config.js` file with:
115+
If you're using a preprocessor like TypeScript or SCSS in your Svelte files, you can create a `svelte.config.js` file so that the Svelte IDE extension can correctly parse the Svelte files.
118116

119117
```js
118+
// svelte.config.js
120119
import { vitePreprocess } from '@astrojs/svelte';
121120

122121
export default {
123122
preprocess: vitePreprocess(),
124123
};
125124
```
126125

127-
So the Svelte IDE extension can correctly parse the Svelte files. This config file is added by default when you run `astro add svelte`.
126+
This config file will be automatically added for you when you run `astro add svelte`.

0 commit comments

Comments
 (0)