RJP RJP - 1 year ago 67
Sass (Sass) Question

How to have urls with a '$' in a SASS file?

I've inherited legacy code, and theres this portion of a class in css:

background: url(//site.com/path/path/$?wid=3&fmt=png/myimg.jpg)

SASS throws an error because it things the '$' is a variable. How can I get around this if I cannot modify the image path on the server?

Answer Source

Surround the URL in quotes. Sass does not look for variables within quoted strings, instead you would have to use the interpolation syntax #{}

background: url('//site.com/path/path/$?wid=3&fmt=png/myimg.jpg') 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download