Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

Why path rel doesn't work - Sass?

// Path to Assets
$path--rel      : "assets/img/";
<img src="#{$path--rel}house-1.jpg">

And it outputs me exactly the same HTML in the browser, why?

1 Answer

Kevin Korte
Kevin Korte
28,149 Points

sass parser doesn't work outside of a sass file. You can't do what you're trying to do with sass in an html file.

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

But Guil did that with JavaScript on one of his vidoes linking it in HTML if im correct, I don't have access to it so i can't re-visit it.

Kevin Korte
Kevin Korte
28,149 Points

Javascript is very different than Sass, which you have no javascript listed here.

You're trying to use Sass interpolation in html, and I am 100% sure Guil did not do that.

You can set css styles dynamically with Javascript, and you could do something similar, but it would not be using Sass.