-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
How to set the image path from SCSS files #1217
Comments
Hi! I'm not sure - generally-speaking, Webpack wants you to use relative paths. So |
if you use both Sass and Tailwind (through Postcss) in your config, Postcss (and so Tailwind) will see the output of the Sass compilation as a single file. So when Tailwind resolves relative paths, it will do so relatively to your Sass entrypoint, not relatively to the Sass partial that you imported and which contains the code. Sass itself does not have a feature to rewrite relative URLs from imported partials (there is a discussion about adding a feature for that in the Sass language in sass/sass#2535 but that feature is not ready yet) |
Hi, so I need to wait about the feature at sass level ? |
After thinking, perhaps can I modify the setting for the outpout path into webpack config ? Actually the setting is:
and images are into: |
Thank you for this issue. |
Hello,
I have an issue about my images path into my CSS. So after looking at webpack encore setting, I modifiy the location folder as it become this (tailwind syntax):
@apply bg-[url(assets/images/SVG/flag-france.svg)];
with this location/assets/images
, in replacement of@apply bg-[url(../../images/SVG/flag-france.svg)];
linked to withimages/
. Now I can see previsualisation images in vscode. But when I compile I get an error like this:./css/src/tailwind.scss" contains a reference to the file "assets/images/SVG/flag-france.svg"
.This syntax seem to work as equal in vscode:
bg-[url(../../../../assets/images/SVG/flag-france.svg)];
But lead to the same error message :This file can not be found, please check it for typos or update it if the file got moved.
So I don't understand why, do I need to change something in the webpack encore config ( as I used the basic config) .
https://gitlab.com/themes-d9/starter-d9-2022/-/blob/d5ec178af9a9299a5ea5395d1af8954257f27f18/webpack.config.js
What are your thoughts about this ? Thanks
The text was updated successfully, but these errors were encountered: