Skip to content

Commit

Permalink
docs(svelte+storybook): add configuration when using storybook with s…
Browse files Browse the repository at this point in the history
…veltekit (#3096)

Co-authored-by: Abraham <[email protected]>
  • Loading branch information
cmseeling and anubra266 authored Jan 19, 2025
1 parent 4b70f29 commit 0d6358d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion website/pages/docs/installation/storybook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,4 @@ export default defineConfig({
staticCss: {
recipes: '*'
},
})
})
27 changes: 26 additions & 1 deletion website/pages/docs/installation/svelte.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,31 @@ export default defineConfig({
})
```

If you’re using Storybook for a SvelteKit project, you need to replicate the same Vite server config changes. In your .storybook folder, you likely have a `main.js` (or `vite.config.js` in older Storybook versions). Update it as follows:

```js filename="main.js"
import { defineConfig, mergeConfig } from 'vite';

/** @type { import('@storybook/sveltekit').StorybookConfig } */

const config = {
// other Storybook config...
viteFinal: async (config) => {
return mergeConfig(
config,
defineConfig({
server: {
fs: {
allow: ['styled-system']
}
}
})
);
}
};
export default config;
```

### Configure the entry CSS with layers

Create the `app.css` file in the `src` directory and add the following content:
Expand Down Expand Up @@ -300,4 +325,4 @@ const config = {
};

export default config;
```
```

0 comments on commit 0d6358d

Please sign in to comment.