Hey guys,
I used .Scratch to implement conditional script/css loading, and it works perfectly when I run hugo server -D
When I simply run hugo and publish the result (public folder), the css no longer loads. Why would there be a difference between the two?
Any ideas are appreciated.
Can you post a link to a public repository for your project?
I found the solution, it was a simple mistake.
I was setting the Scratch value after I was using it in my header.html l instead of before. I simply moved {{ .Scratch.Set…}} above partials that use it, see below pic, and that fixed it.

PS: It is still weird that it worked on my localhost…maybe it was a race condition?