bholloway / resolve-url-loader

Webpack loader that resolves relative paths in url() statements based on the original source file
563 stars 71 forks source link

Not working when url start with `/` #48

Closed idangozlan closed 7 years ago

idangozlan commented 7 years ago

Hi,

Maybe I'm doing something wrong, when im using the following syntax: background: url(/myimage.png); is not working, but when im using: background: url(myimage.png) It's working.

Any solution?

bholloway commented 7 years ago

You are specifying a file. Similar to js imports in node.

So no slash or dot-slash is relative to the CSS or SCSS file. Whereas a leading slash is an absolute path.

It would be interesting to use the new debug option and see what paths are being searched in that case. I think it would fail immediately since the path is outside the project.

If you want to access a package then use a leading tilde "~" and then package name. Otherwise use relative paths.

idangozlan commented 7 years ago

Thank you!