getStyle doesn't work
I have
content.ts
:
In practice, the iframe will be injected, but the styling won't apply25 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The styling won't apply because Plasmo creates a Shadow DOM, which isolates the web page's style from the component's styling. The Shadow DOM prevents the web page's style from affecting the component's styling and vice-versa.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I don't think my content script is complex enough to justify a CSUI
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It's merely injecting an iframe whose only dynamic thing is the src
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
You mean, with
.style.cssText
? It seems like a waste of computational powerUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'd rather have an external CSS file that runs on the page
Can you remind me how to add such a file?
Like where do I put it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Import the stylesheet twice and use the IDs
#plasmo-mount-container
and #plasmo-shadow-container
to alter the Root Container
styles in your CSS.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
lmfao
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Getting ChatGPT would be more efficient
Right, but it's relevant for CSUI, not exactly my use case
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I mean, I want to have a CSS file running on the page
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
In that case I can put the CSS code directly
But how can I have an external CSS file that I attach to the manifest level?
I forgot where to put it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
{% Label %}manifest.json:{% endLabel %}
{% Label %}content.js:{% endLabel %}
But where do I put the
style.css
?
In the root level?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Is there a static dir that I could place the
style.css
in and directly refer to it in the manifest?
Or do I have to use this solution?