Importing CSS only in Storybook
See original GitHub issueThis is an unusual use case but I’m trying to import the css only for use in the storybook. Currently this is what I have:
Config.js
import { configure } from '@kadira/storybook';
require('../node_modules/@salesforce-ux/design-system/assets/styles/salesforce-lightning-design-system.css');
function loadStories() {
require('../components/stories/StandardInput');
// require as many stories as you need.
}
configure(loadStories, module);
webpack.config.js
const path = require('path');
module.exports = {
module: {
loaders: [
{
test: /\.css?$/,
loaders: [ 'style', 'raw', 'css'],
include: path.resolve(__dirname, '/')
}
]
}
}
I’m getting the following error:
ERROR in Loader C:\Users******\Desktop\JSApp\node_modules\raw\raw.js didn’t return a function @ ./~/@salesforce-ux/design-system/assets/styles/salesforce-lightning-design-system.css 4:14-119 13:2-17:4 14:20-125
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Styling and CSS - Storybook
Importing CSS files. If your component files import their CSS, Storybook's webpack configuration will work out of the box. The noticeable exception to...
Read more >How do I include global styles (scss) once for all Storybook ...
There doesn't seem to be a clear concise way to do this. ... Attempts: Import the global styles within each component. Results: Styles...
Read more >6 Ways To Configure Global Styles for Storybook | by Jennifer Fu
Among them, we prefer the imports way. It imports a global style file in preview.js . It is simple, and the changes are...
Read more >How to use css-modules with storybook 6 - Stack Overflow
My css-module is not working with Storybook. There are not any error, it is only not working. I don´t understand what is the...
Read more >Import Global Stylesheets for all Stories in preview.js
In this lesson, we configure Storybook to load global stylesheets for all stories. This is a great way to get general CSS into...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah,
I just looked into my package json and raw was missing. I think i had raw in but not raw-loader. Once i did that it all worked. Thank you for your help!
Great.