How to modify paths inside CSS url(). #20241
Unanswered
BUPTlhuanyu
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I created a plugin that uses resolveId to modify image file paths in JavaScript imports, for example changing
./assets/demo.png
to./assets/demo.png?no-inline
. However, the resolveId hook cannot processbackground-image:url('./assets/demo1.png')
in CSS/LESS/SASS files.If using a PostCSS plugin, it needs to be added in the css.postcss configuration, but this causes Vite to stop looking for the local postcss.config.js file. So, can Vite expose a configuration option to modify url() in CSS?
Beta Was this translation helpful? Give feedback.
All reactions