Fix style issues in Storybook production build #3688
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
The Storybook production build injects some CSS into the iframe used to render the stories. This uses nesting, which while well supported in browsers, causes issues with some build tooling which is not expecting it.
The
vite-plugin-html
minifies the CSS in anystyle
tags by default, but this minification process does not account for nested CSS. The net result of this is that some of the styles which are expected to be scoped to.sb-errordisplay
end up applying globally instead.The most obvious manifestation of this was on the PipelineRun details story where there was an additional gap between each Task in the TaskTree caused by an unexpected
li+li
rule.Note
This only affected display in the Storybook
Disable CSS minification in the HTML plugin since we don't need this for Storybook, and don't make use of
style
tags as part of the template for the Dashboard application itself./kind misc
Before:
After:
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes