Homec4science

Use Celerity to version all static resources

Authored by epriestley <git@epriestley.com> on Apr 8 2012, 19:07.

Description

Use Celerity to version all static resources

Summary:
We don't use versioned URIs for images, so when they change users may get old versions.

This was a particular issue with the recent logo change, which several users reported cache-related issues from.

Instead, use Celerity to manage image URI versions in addition to CSS/JS.

This is complicated, because we need to rewrite image URIs inside of CSS, which means the hash of a CSS file has to be derived from the current image data. Otherwise, when we updated an image the CSS wouldn't update, so we wouldn't be any better off.

So basically we:

  • Find all the "raw" files, and put them into the map.
  • Find all the CSS/JS, perform content-altering transformations on it (i.e., not minification) based on the partial map, and then put it into the map based on transformed hashes.

(If we wanted, we could now do CSS variables or whatever for "free", more or less.)

Test Plan:

  • Regenerated celerity map, browsed site, verified images generated with versioned URIs.
  • Moved "blue" flag image over "green" flag image, regenerated map, verified "green" flag image and the associated CSS changed hashes.
  • Added transformation unit tests; ran unit tests.

Reviewers: btrahan, vrana, jungejason

Reviewed By: vrana

CC: aran

Maniphest Tasks: T1073

Differential Revision: https://secure.phabricator.com/D2146

Details

Committed
epriestley <git@epriestley.com>Apr 8 2012, 19:07
Pushed
aubortJan 31 2017, 17:16
Parents
rPHf7b569e5d9b7: Don't use "/e" in PHPMailer Lite
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHe4df9590642d: Use Celerity to version all static resources (authored by epriestley <git@epriestley.com>).Apr 8 2012, 19:07