URL as a Sass Variable

Do you ever find yourself trying to remember the URL path of you images directory? Well with Sass you can quickly add the path to the desired location and just use the variable throughout your code. Sass to the rescue.

All you need to do is declare the variable and then use the interpolation syntax when you reference it.



$get-path-to-assets : "http://web-design-weekly/images";

body {
  background: url(#{$get-path-to-assets}/classy_fabric.png) repeat-x fixed 0 0;
}

More details about the interpolation syntax

This post currently has no responses. What do you think?

You can use basic HTML when posting code, please turn all < characters into &lt; or > into &gt;
If the code is multi-line, use <pre><code></code></pre>

Leave a Reply

Your email address will not be published. Required fields are marked *

Current ye@r *