@jasen
To add Sass support to Storybook, you need to follow these steps:
- Install Sass in your project by running the following command:
1
|
npm install node-sass sass-loader
|
- Create a file named webpack.config.js in the .storybook directory of your project.
- Add the following code to the webpack.config.js file to configure Sass support:
1
2
3
4
5
6
7
8
9
10
11
|
const path = require('path');
module.exports = ({ config }) => {
config.module.rules.push({
test: /.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
include: path.resolve(__dirname, '../'),
});
return config;
};
|
- Import your Sass files in your stories or components as needed:
1
|
import '../path/to/your/styles.scss';
|
- Run Storybook to see your components styled with Sass:
By following these steps, you should have Sass support added to your Storybook project.