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 Modular CSS with Sass Getting Modular with Mixins and Functions Background Image Mixin

SVG not displaying in Workspaces preview

Hello,

I was just wondering why the "logo.svg" was not displaying for me in the Workspaces preview? Was there something I missed?

Here's my code:

_utilities.scss

@mixin img-replace($img, $w, $h, $disp: block) {
  background-image: url('#{path--rel}/#{$img}');
  background-repeat: no-repeat;
  width: $w;
  height: $h;
  display: $disp;
}

_main.scss

.site-logo {
  margin-bottom: 2em;
  @include img-replace("logo.svg", 115px, 45px, inline-block);
}

Edit:

Nevermind, got it to work now. Syntax error: missing a $ in front of path--rel. So, it should read:

  background-image: url('#{$path--rel}/#{$img}');