Sage 9 - npm build creates wrong path for images

In my CSS file I’m setting a background image using the css property background: url('my-image').

It works just find when I’m using webpack to watch my file, but when I compile using npm run build, the path to the image is incorrect. Instead of using my theme name, it still references sage.

The final output is http://mysite.dev/app/themes/sage/dist/images/img.jpg . Everything else works, only whenever I try to reference an image through my CSS is the file path incorrect. Any ideas? Thanks in advance.

Well, I figured it out. Guess I just needed to rubber duck it to the discourse board. I modified the publicPath in assets/config.json to reference my theme, instead of sage. Haven’t noticed any errors or bugs as of yet.

3 Likes