3 ms·
Sprockets 2 (not yet a gem, point to git) makes a lot of this easier. You can put extra extensions on your files to get them processed with ERB or similar befor
by mrkurt 16y ago
Sprockets 2 (not yet a gem, point to git) makes a lot of this easier. You can put extra extensions on your files to get them processed with ERB or similar before they're served, so you can actually append auto generated asset versions to URLs in CSS files if you want. It also sends appropriate status codes when there's a stale version (410 Gone).
Sprockets 2 behind Amazon CloudFront does asset handling almost exactly like I want it done.
- 2is10 16y agoBut any dynamic processing of stylesheets sacrifices performance. It means they have to be served by Rails. Preprocessing before deployment frees you to host them anywhere, ideally closer to your users.
- mrkurt 16y agoI get exactly that with CloudFront, a custom origin (with Sprockets), and appropriate HTTP headers. If CloudFront doesn't see a file, it asks Sprockets for it and caches it however long I tell it to. You can do the same with Varnish if you don't want to use Amazon's CDN. Having run a large site with prebuilt assets for several years, I really enjoy not having to do it anymore.