Live data from Hacker News

Bulletproof Rails Asset Caching

eng.wealthfront.com

11–14 of 14 posts

Re: Bulletproof Rails Asset Caching

#11
post #3
post #2

Looks interesting. Pre-generating asset files for deployment might also be a nice alternative to the usual tricks[1] for using SASS (or other CSS generators) with Heroku, which have rack middleware reading a cache. (Unfortunately, the code samples were a hard for me to read, in both Firefox and Chrome --- all the newlines seem to have somehow gotten squeezed out...) [1] https://github.com/pedro/hassle

I believe that in Rails 3.1 they're including a fix for this, so work arounds like this won't be necessary anymore :)

Got a link to details? I'd be surprised, since any correct solution requires two-stage deployment and keeping old assets around. These capabilities are beyond the scope of a web server framework. The Rails team could certainly educate Rails developers and choose conventions that make correctness easier.

Re: Bulletproof Rails Asset Caching

#12
Compass/SaSS + AssetFingerPrint + jammit is a great way to what wealthfront is doing.

Compass has helpers that use the Rails asset link helpers to link to images. There are sprite helpers available as well.

AssetFingerPrint is a Rails plugin that tosses and MD5 into the asset link automatically.

Jammit compresses CSS/JS files, and the fingerprint of the resulting compiled files are picked up by AssetFingerPrint.

Thats how we roll at Poll Everywhere.

Re: Bulletproof Rails Asset Caching

#13
post #11
post #3

Earlier quoted context omitted.

I believe that in Rails 3.1 they're including a fix for this, so work arounds like this won't be necessary anymore :)

Got a link to details? I'd be surprised, since any correct solution requires two-stage deployment and keeping old assets around. These capabilities are beyond the scope of a web server framework. The Rails team could certainly educate Rails developers and choose conventions that make correctness easier.

[deleted]

Re: Bulletproof Rails Asset Caching

#14
post #4

It's difficult for this to not sound snarky, but my definition of bulletproof doesn't involve parsing CSS with bash and awk.

You've missed the point. 90% of Rails websites behave badly every time they're deployed, and the developers don't even realize it. I included our build scripts in the post to illustrate how simple it is to fix the problem. The important thing is that people reliably version their asset URIs, not what tools they use to do it.
Post reply on HN