Path to sprite
Opened this issue · 2 comments
It works finally, thank you so much!
But the documentation should be more clear about the path is relative to Gulpfile. Most Frontend Developers use naturally the Document root, that won't work. It took some time to find it out :)
It would be nice if we could use a path in CSS:
li {
background: url(relative-path-to-file/symbols.svg#arrow-right) no-repeat;
}
Hi @Dotmagic. Thanks for bringing this up. Hopefully this is good news for you, but the first directory used to resolve paths should be the directory of the current stylesheet (and it should be smart enough to know the directory of imported files).
Here’s how it works:
-
When we find a declaration with a
url()
we try to get the directory of the current source file. reference -
Then, we pass this working directory in as the first path to check for an SVG. reference
-
Starting with that current working directory (
cwd
) and whatever was passed into the url functionurl(id)
, we begin the SVG Resolve Algorithm.
Does this help? Are you experiencing a bug with this expected behavior?
I can confirm it works with variable relative paths once I've add document root to resolved dirs. Thanks