Skip to content

feat: add cssEmitAsset option#10235

Closed
manucorporat wants to merge 1 commit intovitejs:mainfrom
BuilderIO:customize-css-inlining
Closed

feat: add cssEmitAsset option#10235
manucorporat wants to merge 1 commit intovitejs:mainfrom
BuilderIO:customize-css-inlining

Conversation

@manucorporat
Copy link
Contributor

@manucorporat manucorporat commented Sep 24, 2022

Description

As Qwik maintainer, i would like to disable the default behaviour of Vite that emits .css files, Qwik is a bit special, and this is not a good practice, instead we would like all css imports to behave like inline imports:

ie.

import css from './styles.css'

same as:

import css from './styles.css?inline'

Occasionally, we find developers forgetting the ?inline and causing double load of the styles.

Additional context

This is an important issue for us, i understand that adding a new option is not ideal, but i think it's a valid use case.

Also, i understand the naming, or location of the config might not be correct, i am open to any different API as long as we can change the default behaviour!

As soon as some vite core team confirms this can get merged, i can work on adding new unit tests!!

Thanks so much for the amazing work!

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bluwy bluwy added feat: css YAO Yet another option... p2-to-be-discussed Enhancement under consideration (priority) labels Sep 25, 2022
@patak-cat
Copy link
Member

I think it is a good idea to help Qwik users here. I wonder if this could be done through a plugin using enforce: 'pre' (or the new hook-level option resolveId: { order: 'pre', handle: ... })? Resolve id could auto-add the ?inline query?

Something like
https://stackblitz.com/edit/vitejs-vite-dhmdzy?file=vite.config.js&terminal=dev

@manucorporat
Copy link
Contributor Author

ok! let's close it, we will try to solve it using that trick! thanks a lot! if i find some trouble might ping u again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: css p2-to-be-discussed Enhancement under consideration (priority) YAO Yet another option...

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants