In the following SCSS, I would like to use the fg-color
variable within the url
background-image
attribute.
$fg-color: #ff6464;
i.icon-back {
background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'><path d='M10,0l2,2l-8,8l8,8l-2,2L0,10L10,0z' fill='%23ff6464'/></svg>");
}
At the moment the value, of the variable in simply repeated within the SVG string, like so:
fill='%23ff6464'
I would like this to be automatically updated whenever the fg-color
variable is updated.
How can I do this?
UPDATE:
This input SCSS:
i.icon-back {
background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'><path d='M10,0l2,2l-8,8l8,8l-2,2L0,10L10,0z' fill='$fg-color'/></svg>");
}
Outputs this CSS:
i.icon-back {
background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'><path d='M10,0l2,2l-8,8l8,8l-2,2L0,10L10,0z' fill='$fg-color'/></svg>");
}
... it is exactly the same - the variable is not processed.
NOTE:
I have reviewed these questions, that appear to be similar, but are not the same: