Hacker News new | ask | show | jobs
by skidooer 5477 days ago
The article states that only the filename needs to be passed for CSS url() resources. However, using that method, there appears to be no means to append the MD5 to the precompiled asset filename while in production. The result is an unnecessary trip to the application to generate the asset, bypassing the compiled assets completely.

I believe the preferred method it is to generate your CSS with ERB, using the asset_path method. Though hopefully someone can correct me if I'm wrong.

2 comments

You're unfortunately correct. This worked initially fine for us, as all resources were served through CDN. However, when images were changed and deployed the results weren't expected.

ERB helpers seem to be the only way currently.

There should be a way to have a sass mixin that generates the md5 timestamp for the asset filename in the sass files, instead of having erb process the whole sass file.