Oops, figured it out. I had enabled activate :asset_hash
. removing that from config.rb
fixed it.
Middleman Build assets without hash
-
28-06-2022 - |
Question
How do I configure Middleman to build images without appending a hash to the filename? I'm referring to filepaths in javascript and need to know the full filename to refer to the files. My JS doesn't get updated with the hashed filenames like my CSS does.
Solution
OTHER TIPS
No need to abandon :asset_hash
just because you want to refer to them in JS. The asset hash extension actually attempts to rewrite paths in CSS and JavaScript automatically, but it sounds like whatever way you're linking them isn't getting detected.
You can always name your javascript something like application.js.erb
and then have code like this:
var my_image = <%= image_path("myimage.png") %>;
That way you'll always have the right path.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow