"Did you clear the browser cache?" Introducing asset generations

Showing 1-1 of 1 messages
"Did you clear the browser cache?" Introducing asset generations Tom Boutell 7/3/12 9:06 AM
Have you had this conversation with your client recently?

"I deployed the fix."

"I don't see it!"

"Did you clear your browser cache?"

"Um..."

I'm pleased to announce that, for Apostrophe sites, this conversation
is at an end. (:

The new "asset generation" feature adds a prefix to all CSS and JS
filenames produced by our minifier. That prefix changes on every
deployment, via the new apostrophe:bump-asset-generation task, which
is run remotely by the apostrophe:deploy task.

For performance reasons the prefix is loaded as part of app.yml. To
make that happen you need to add one new line to your app.yml file
(already standard in our sandbox for new projects):

all:
  a:
    <?php if (file_exists(dirname(__FILE__) .
'/asset_generation.yml')) require dirname(__FILE__) .
'/asset_generation.yml' ?>

That, and updating your apostrophePlugin via svn, is all you have to
do. And if you don't want the feature, just leave that line out of
app.yml, and nothing will change.

Note that this means you can also configure Apache to cache the
minified assets forever, since the filenames change on new
deployments. That's an additional speed boost and reduction of server
load for sites that have a lot of repeat visitors.

Enjoy!

(I'd like to acknowledge that Jeremy Kauffman nudged me to do this for
quite a while.)

--
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com