@sveltejs/vite-plugin-svelte 1.0.0-next.9 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,62 +1,28 @@
1
1
  # @sveltejs/vite-plugin-svelte
2
2
 
3
- ## usage
3
+ The official [Svelte](https://svelte.dev) plugin for [Vite](https://vitejs.dev).
4
+
5
+ ## Usage
4
6
 
5
7
  ```js
6
8
  // vite.config.js
7
- const svelte = require('@sveltejs/vite-plugin-svelte');
8
- const { defineConfig } = require('vite');
9
-
10
- module.exports = defineConfig(({ command, mode }) => {
11
- const isProduction = mode === 'production';
12
- return {
13
- plugins: [
14
- svelte({
15
- /* inline options here */
16
- })
17
- ],
18
- build: {
19
- minify: isProduction
20
- }
21
- };
9
+ import { defineConfig } from 'vite';
10
+ import { svelte } from '@sveltejs/vite-plugin-svelte';
11
+
12
+ export default defineConfig({
13
+ plugins: [
14
+ svelte({
15
+ /* plugin options */
16
+ })
17
+ ]
22
18
  });
23
19
  ```
24
20
 
25
- ## Options
26
-
27
- vite-plugin-svelte reads the vite configuration and uses an appropriate default configuration
28
-
29
- It also loads `svelte.config.js` (or `svelte.config.cjs`) from the configured `vite.root` directory automatically.
30
-
31
- Options are applied in the following order:
32
-
33
- 1. vite-plugin-svelte defaults
34
- 2. svelte.config.js in vite.root
35
- 3. inline options passed in vite.config.js
36
-
37
- It supports all options from rollup-plugin-svelte and some additional options to tailor the plugin to your needs.
38
-
39
- For more Information check [options.ts](src/utils/options.ts)
40
-
41
- ## Integrations for other vite plugins
42
-
43
- ### Add an extra preprocessor
44
-
45
- vite-plugin-svelte uses the svelte compiler to split `.svelte` files into js and css and the svelte compiler requires that the css passed to it is already plain css.
46
- If you are building a plugin for vite that transforms css and want it to work out of the box with vite-plugin-svelte, you can add a `sveltePreprocess: PreprocessorGroup` to your vite plugin definition and vite-plugin-svelte will pick it up and add it to the list of svelte preprocessors used at runtime.
47
-
48
- ```js
49
- const vitePluginCoolCss = {
50
- name: 'vite-plugin-coolcss',
51
- sveltePreprocess: {
52
- /* your PreprocessorGroup here */
53
- }
54
- /*... your cool css plugin implementation here .. */
55
- };
56
- ```
21
+ ## Documentation
57
22
 
58
- Check out [windicss](https://github.com/windicss/vite-plugin-windicss/blob/517eca0cebc879d931c6578a08accadfb112157c/packages/vite-plugin-windicss/src/index.ts#L167)
23
+ - [Plugin options](../../docs/config.md)
24
+ - [FAQ](../../docs/faq.md)
59
25
 
60
26
  ## License
61
27
 
62
- MIT
28
+ [MIT](./LICENSE)