Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: (Docs) Minor adjustments to the install addons docs #17224

Merged
merged 1 commit into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions docs/addons/install-addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,20 @@ Storybook preset addons are grouped collections of specific `babel`,`webpack` an

For example, to use SCSS styling, run the following command to install the addon and the required dependencies:

```sh
yarn add -D @storybook/preset-scss css-loader sass sass-loader style-loader
```
<!-- prettier-ignore-start -->

<CodeSnippets
paths={[
'common/storybook-preset-scss.webpack-4.js.mdx',
'common/storybook-preset-scss.webpack-5.js.mdx',
]}
/>

<!-- prettier-ignore-end -->

<div class="aside">
💡 Tip: Use the Webpack 5 snippet only if your framework already includes support for this version. Otherwise, use the Webpack 4 snippet.
</div>

Next, update [`.storybook/main.js`](../configure/overview.md#configure-story-rendering) to the following:

Expand Down Expand Up @@ -81,4 +92,4 @@ Consider the following example:
Preset addons may also have addon-specific configuration. Read their respective READMEs.
</div>

Now, when Storybook starts up, it will update webpack's CSS loader to use modules and adjust how styling is defined.
Now, when Storybook starts up, it will update webpack's CSS loader to use modules and adjust how styling is defined.
7 changes: 7 additions & 0 deletions docs/snippets/common/storybook-preset-scss.webpack-4.js.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```shell
# With npm
npm install @storybook/preset-scss css-loader@5.2.7 sass sass-loader@10.1.1 style-loader@2.0.0 --save-dev

# With yarn
yarn add --dev @storybook/preset-scss css-loader@5.2.7 sass sass-loader@10.1.1 style-loader@2.0.0
```
7 changes: 7 additions & 0 deletions docs/snippets/common/storybook-preset-scss.webpack-5.js.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```shell
# With npm
npm install @storybook/preset-scss css-loader sass sass-loader style-loader --save-dev

# With yarn
yarn add --dev @storybook/preset-scss css-loader sass sass-loader style-loader
```