storybook icon indicating copy to clipboard operation
storybook copied to clipboard

How do you share scss raw data with storybook?

Open travis5491811 opened this issue 4 years ago • 1 comments

How do you share scss with storybook? I have this question here https://stackoverflow.com/questions/66554897/how-do-you-share-scss-variables-with-javascript-in-nuxt. When building style guides, it seems nuxt users have 2 options for displaying scss variables.

  • Duplicate the data in .scss file and .stories.js
  • Export the data from .scss into .stories.js and dynamically show it in stories.

I tried the last option and even though my nuxt and storybook app is clearly taking advantage of my .scss styles, console.log returns empty when i try to import the styles. Is this a limitation of nuxt storybook? Is there any way to export my styles and classes from my .scss so i can display their names, information and uses in my stories?

As an example, i'm trying to do the following but it doesn't work https://css-tricks.com/getting-javascript-to-talk-to-css-and-sass/

travis5491811 avatar Mar 10 '21 15:03 travis5491811

@travis5491811 I've been using this solution with success: https://github.com/mdx-js/mdx/discussions/1952#discussioncomment-2266384

CharlesCoqueret avatar Apr 27 '22 20:04 CharlesCoqueret

v4 of this module is no longer actively supported. Please try the newest version and open an new issue if the problem persists. Thank you for your understanding.

tobiasdiez avatar May 01 '24 07:05 tobiasdiez