Open mikaelh94 opened 5 months ago
Start a new pull request in StackBlitz Codeflow.
I have the same problem. the css leaks into ours components. In my case borders not work
i think that's the same problem as in #339
It is hacky, but a way to put the css of histoire in a separate layer, is to include the following code into histoire.setup.ts
:
document.head
.querySelectorAll('style[type=\'text/css\'][data-vite-dev-id*=\'histoire\']')
.forEach((style) => {
style.setAttribute('data-layer', 'histoire')
const content = style.textContent
if (!content?.includes('@layer')) {
style.textContent = `@layer histoire {${content}}`
}
})
This will create a histoire
layer and add existing styles inside.
This was inspired by the solution of @qexk https://github.com/histoire-dev/histoire/issues/339#issuecomment-1522329599.
Describe the bug
I use PrimeVue for my components, with the PrimeVue default style and my custom css on top of it.
PrimeVue's default styles are in a layer:
When running Histoire, there is some Histoire/TW styles that are not in a layer and they override PrimeVue default styles: histoire-app/src/app/style/main.pcss
Since a css property defined without any layer will always have more specificity than a layered css property, those global styles should be in the
@layer base
no ? Like found in this tw issueLook at my StackBlitz, the TW default border (
border-color: #e5e7eb;
) override my BaseInput invalid border color.Reproduction
https://stackblitz.com/edit/histoire-vue3-starter-gvitle?file=src%2FBaseButton.story.vue
System Info
Used Package Manager
yarn
Validations