Shawjak3
Shawjak3

Reputation: 541

How do I reference an image in my stencil theme

I am wondering how to correctly reference an image in my scss for my stencil theme I am working on. It works locally but when I upload my theme to bigcommerce it gives a 404 error.

background: url('../img/header-bg.png') no-repeat; background: url('/assets/img/header-bg.png') no-repeat;

Those both work locally but both result in a 404 when I upload my theme. I have included the image in that directory and everything.

Upvotes: 1

Views: 1194

Answers (1)

thannes
thannes

Reputation: 778

I've had the same issue you are experiencing, and I'm not 100% sure what the BC recommended way to reference background images in CSS.

Assuming you are placing the images in your assets/img directory I've found that calling background:url('../img/header-bg.png') like this has worked both locally, and in production.

Hope this helps.

Upvotes: 1

Related Questions