question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing CSS only in Storybook

See original GitHub issue

This 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:closed
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mgarfcommented, May 2, 2016

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!

0reactions
arunodacommented, May 2, 2016

Great.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found