#What's the proper way to import global less styles for all stories?

3 messages · Page 1 of 1 (latest)

gritty tree
#

I'm currently trying to build React component using less as styles preprocessor. Lib index.js imports global styles, then components with their styles...that's how styles are combined. But is there any way not to import global styles in every single story? Maybe some decorator or smth like that?

ruby oar
#

You should be able to import your styles into .storybook/preview.js, which is loaded for every story.

gritty tree
#

Seems like it's not working 😦

My preview.tsx

import '@condo/ui/src/components/style/core/global.less'

export const parameters = {
    actions: { argTypesRegex: '^on[A-Z].*' },
    controls: {
        matchers: {
            color: /(background|color)$/i,
            date: /Date$/,
        },
    },
    backgrounds: { disable: true },
}

And SB launching fails with:
Variable @condo-global-spacing-12 is undefined

Inside global.less are just imports vars + fonts