Theme styles binding #675
Mister-Hope
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
I don't have a perfect solution so far. IMO, allowing users to override components is also a hack way 🤔 |
Beta Was this translation helpful? Give feedback.
1 reply
-
Here is a workaround, but it will slow down page load speed:
This will avoid the component bundled in async layout chunks, so that the style can be outputed in css, but it also means that the component will be bundled into app entrance js anyway, no matter if the current page is using it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Now, it's hard dealing with theme styles in vuepress.
Injecting styles in clientEnhance files
Placing all the styles together and import it through client enhance, this is exactly default theme is doing
Why is this Problematic
The styles will injected anyway
new value !important
to overide exisiting css properties, orunset !important
to clear them, and this is annoyingBind styles in component
This seems to be a good solution, as removing or replacing component will be done with their styles, but as the whole layout is an
AsyncComponent
, the styles will not be imported untill the component loads, so the css won't be available when the page loads.While the page has an ssr result, this will result the whole page shrink:
So I am wondering if there is ( or we can provide) a way to bind styles to layout and component where they are used, and let them tack effect when loading the first time. @meteorlxy
Beta Was this translation helpful? Give feedback.
All reactions