Inline styles from css-modules in bundle #18780
Unanswered
Andrey-Bobukh
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a requirement to build a single all-in-one js file, including both code and styles of my app.
And I want to use css-modules.
I know that Vite has an option of importing css files like
file.css?inline
– that will prevent css from being emitted into a separate bundle file, and instead return a string of css code, for me to manually put it wherever I want in html.Same can be done with css-modules – but since they produce their own export, an object with generated classnames – using
?inline
on them will block me access to that object.I.e. it's a choice:
import classes from "my.module.css"
– I can assign classes to elements, but css will be emitted in a separate css bundleimport css from "my.module.css?inline"
– css will be inlined in my js bundle, but I can't assign generated css classes to elements.Is there an option or maybe plugin to have both at once?
same question on SO, unanswered for a while
Beta Was this translation helpful? Give feedback.
All reactions