Load a SCSS image in <img> tag

Hello folks,

I’m creating a theme for my community those few days, and I have a little problem.
I would like to put a banner on the top of my Discourse. And my problem occurs when I want to put an already uploaded image (my logo) in that banner.

I’ve already tried a way like this :

<img src="$my_logo">

And this :

In the HTML
<div id="my_logo"></div>
In the CSS
#my_logo { background-image: url("$my_logo"); }

But unfortunately… none of this ways are functional.

Have you any ideas or clues to help me with this issue ?

Thank you !!

Try removing the quotes, use

#my_logo { background-image: url($my_logo); }

You can’t use SCSS in HTML — your first example won’t work. You’d have to upload the image to your forum and use the direct URL.

2 Likes