Open mklueh opened 3 weeks ago
@Timeraa Hi, just thought I'd ping you quickly.
Have you managed to use UnoCSS with your module in the content script as well?
Hey @mklueh,
sorry for the late reply, It seems to work fine for me, see example linked below:
@Timeraa thank you for your help.
I managed to get it working after looking into your code, but I assume there is a bug.
When using cssInjectionMode: "ui"
(and createShadowRootUi
) it won't work and I needed to switch to cssInjectionMode: "manifest"
to get it working and add
content_scripts: [{
css: [
"content-scripts/content.css"
],
matches: [...]
}]
There seems to also be another issue regarding hot reloading. If you change a UnoCSS class lets say from initially text-gray-500
to 'text-gray-900' while in dev, the component will lose it's style. The new style is contained in content.css
but not applied in the browser.
Not sure if this is a wxt thing or if it's just Chrome caching tho
Describe the bug
Hello,
I've seen the new
@wxt/unocss
is out, thank you very much :)However, I cannot get it working with the content script either, but it works within the popup as expected.
Could you manage to get it working in the content script as well?
What is the general approach here, for example if I decide to use other frontend frameworks? Will they all break and lack CSS in the content script?
Reproduction
entrypoints/content/index.ts
modules: [ "@wxt-dev/module-vue", "@wxt-dev/unocss" ],
unocss:{ configOrPath:"./unocss.config.ts"
},
manifest: { host_permissions: [URL_PATTERN],
}
Used Package Manager
yarn
Validations