Is there any way I can reference this static asset (svg) within my css file without moving it to my static folder? This is a pre-packaged template that is imported as part of a build so I don’t want to have to mess with the directory structure.
This is probably something I can raise as an improvement with Hugo core. Its pretty strange having an asset pipeline that cant do simple relative references.
CSS, you can try setting CSS variables either in resources.ExecuteAsTemplate, or inline in your base template (which I would do), and use those in your CSS; for url I suspect you need to use absolute URLs (e.g. $resource.Permalink)
For CSS in JS, pass these values as params in js.Build.
It’s unclear how to update my background path in the .scss file and update my current code above to include the resources.ExecuteAsTemplate. Thanks for you help.
Clone the example at the bottom of the post. Among other things, this example sets the body background image to the .RelPermalink of an image that has been processed by Hugo. In the example, see: layouts/partials/get-scss-vars.html.