-
Notifications
You must be signed in to change notification settings - Fork 9
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
Be nice to have Sass support #10
Comments
Does https://www.npmjs.com/package/@storybook/preset-scss resolves your need? I'm not quite sure about adding sass support here. |
I've been actively trying to get my storybook configured for standard css/sass modules using the .module.scss and I can confirm that the @storybook/preset-scss preset does not cover this scenario. It does get sass working, and it allows you to pass an options object into it so that you can enable css modules. Where it fails is the file naming convention. With @storybook/preset-scss, the CSS modules options get enabled for any sass file. I still want to retain non-module css/scss files in my project. I would also love if this preset could offer support for Sass Modules. Or if a new preset was created nearly identical to this one, except for scss files. Then we could simply use these two presets to get CSS/SCSS modules fully functioning. FWIW, I did try to create a preset like this, but I keep running into compiler errors that I don't know how to troubleshoot. |
@kintz09 - here's my const path = require("path");
module.exports = {
webpackFinal: async (config) => {
config.resolve.modules.push(path.resolve(__dirname, '../src'));
return config;
},
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
{
name: "@storybook/preset-scss",
options: {
cssLoaderOptions: {
modules: {
auto: true,
},
},
},
},
],
}; EDIT: Ah I see what you're saying. I can still get my non-module sass files working just fine. Can you specify your use case in an example? |
@earthtosid You know, I haven't seen that |
@earthtosid Thank you for sharing your config, I'm actually having great luck with the @storybook/preset-scss preset now! I did have to add an additional option to get the class names exported properly, but this seems more than sufficient for my needs.
Does this |
@kintz09 - not sure if this package is required for your use case as you can pretty much do everything with |
Passing the modules options to the I will remove the |
@tosidsethi I removed I also took another peek at the source code for I went ahead and opened a new issue in this repo requesting the module options as a feature add. But if anyone knows of other solutions to try, please let me know and I will test it. Thank you! |
If it could only resolve
scss/sass
modules as well, this preset would be worth in gold.The text was updated successfully, but these errors were encountered: