Images not resolved from stylesheet
jdwillemse opened this issue · 2 comments
jdwillemse commented
What path do I need to use in my stylesheets to access an image in the images folder?
From the script files the path is what I'd expect assets/images/file.png
, but this does not work from .scss files.
jdwillemse commented
resolved this by adding ~ to the path ~assets/images/file.png
jeremybarbet commented
Hi!
You shouldn't have to use the ~
symbol to import images from assets/images
directory. Here are two examples of urls with both png and svg.
.images {
&__png {
...
background-image: url('assets/images/favicon.png');
}
&__svg {
...
background-image: url('!file-loader!assets/images/favicon.svg');
}
}
The only difference comes when you have to import svg file, at the moment you have to prepend !file-loader!
to make it works.