storybookjs / addon-cssresources

A storybook addon to switch between css resources at runtime for your story
MIT License
7 stars 4 forks source link

Addon: CSS Resources - Possible to change order of CSS files? #1

Open sander-v-bergen opened 3 years ago

sander-v-bergen commented 3 years ago

storybook_css-order I'm using 'CSS Resources' to switch between different (global) CSS files. This has been set-up in the preview.js and is working as expected.

There is one issue I can't solve: The CSS file from the 'CSS Resources' addon is loaded after the story specific CSS. This results in story specific styling being overwritten by the global CSS.

Example: cssresources is loading bootstrap.css. Button.stories.js is loading its own CSS file Button.css to overwrite specific styles. Due to the order of the CSS files being loaded in the DOM this isn't working.

Is there a way to control the order of the CSS files? So the story specific CSS always loads after global / cssresources CSS files? Thanks!

Information: @storybook/react version 6.2.9 @storybook/addon-cssresources version 6.2.9