can How to Recipes
include 3rd party astro:scope
example?
#11029
Replies: 1 comment 1 reply
-
In general, I'm all for more recipes! 🚀 As you've noted, I will also note that https://astro-tips.dev is also a place for additional content, as well as just writing a blog post or guide oneself! Some of our recipes come from content that individuals have written that we feel is general purpose enough to be helpful in docs, and then we ask if they'd like to contribute directly. And nothing stops anyone from writing a blog post! As for mentioning within the styling documentation itself, while we do show an example of how a style tag compiles to a Do you think it would it be helpful to add an update to the end of that section of the docs something like....
OR, if you do write a recipe showing how to use Do you think one of those solutions would have helped you get where you needed to go? |
Beta Was this translation helpful? Give feedback.
-
This is not really the problem of Astro but when there is a script that inserts some HTML element to DOM with specific scoped styles, it is not being applied. The best workaround was to use
astro-scope
, I can see that this is not the problem of Astro, as the scoped styles are generated via Vite and Vite doesn't know about DOM manipulated elements so it is missing scoped styles. But this really hurts the onboarding user experience of Astro people.scope package
there should be How to guide on how to use this to ensure scoped style management in Astro docs.
Why? I have been experimenting with Astro and I have hit this block with this simple code and I was immediately thinking to go back where I come from [notably svelte] but then someone(in discord support) pointed out me to
astro:scope
package and I solved the issue but obviously this took some time from me while scanning the docs.It would be a good idea to add a simplistic version of the problem below. Frankly there should be a giant warning in styles/DOM scripting docs to point out this possible issue. Like partials docs warn about users to not include CSS/JS in the partials.
example
Beta Was this translation helpful? Give feedback.
All reactions