-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to exclude certain css @import
statements from getting inlined
#18037
Comments
|
Well they do seem to share the root issue: there's no way to filter out the I didn't come across that issue when searching before opening this one, I guess in a way it is a duplicate (unless we treat this as 'not being able to configure |
Yeah, it shares some parts. But I think it's fine to have it separately because #13998 wants to externalize a CSS file in both dev and build, and this issue wants to externalize a CSS file only in build. |
Use them as CSS variables, so they’ll automatically be updated when MediaWiki ships a new Codex version without having to rebuild the app (and they can depend on the skin too). To avoid including all the design tokens in the build anyway (Vite doesn’t really support excluding CSS imports yet, see vitejs/vite#18037), we have to make sure to not import the tokens anywhere in the app (i.e. neither in NewLexemeForm.vue nor in App.vue) – only directly in the index.html (dev entry point). Bug: T369505
Describe the bug
I'm building a library which exports some css, but also imports some more from a second library.
The objective I'm pursuing is not to extract CSS files coming from a component library and keep them as imports, since that library itself will be already used by all consumers. Doing so also gets rid of possible specificity issues as the component library is always imported before the library's own styles.
The CSS is simple enough:
where an import is stated before tailwindcss' own styles.
Since Vite provides
@import
inlining (as stated here), this import statement gets extracted and the content is merged in the output .css file.Currently, it seems as there's no way to exclude certain import statements from getting inlined. This should be doable with
postcss-import
(usingfilter
), however Vite already uses this plugin internally, and it seems like there's no way to configure it. Additionally, providing the postcss plugin in thecss.postCss.plugins
array seems to ignore the plugin (possibly getting skipped as it's a duplicate plugin?).Is there a way to achieve this result and if not, can a way to exclude imports be proposed so that there's more flexibility here?
These issues/questions seem related:
postcss-import
plugin #16669 (unability to configurepostcss-import
)Reproduction
https://stackblitz.com/edit/vitejs-vite-t6nqaz
Steps to reproduce
npm run build
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: