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.

有帮助吗?

解决方案

Oops, figured it out. I had enabled activate :asset_hash. removing that from config.rb fixed it.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top