[thelist] Managing css, images, js versioning

Bill Moseley moseley at hank.org
Tue Dec 4 20:35:58 CST 2007

I'm curious about how others manage resource versions (and cache
busting) for images, css, javascript and maybe other items linked from
your application.

I keep these items under subversion.

So take Javascript for example.  In my applications I have "macros"
that might load some javascript:

    load_js( 'foo.js' );

Now, how (where) that loads depends on if the application is under
development, staging, or production.

Under development it might point to a local sever mapped to a
subversion checkout.  Obviously, the developer will want to be able to
edit, say, a .js file and test without having to check in code.

Also, there are often many separate javascript files during
development, so "foo.js" might be some js that loads many files.

But, under production we need to track versions -- if a new
application is released we need to have it point to a new version(s)
of files that may have changed between versions.  URLs must change to
bust browser caches.  Also under production the javascript is often
minified, compressed, and combined into just a few files (to
front-load the js).

Another twist to this is if we produce multiple application then there
may be a large number of files that are shared between applications
(common images most likely).  I'm mixed on my opinion if each
application should always have its own complete set of files (which
would mean duplication) or share files across applications (which
could mean version mis-matches).

I realize this varies a lot between systems and applications, but it's
something I've been thinking about lately and it would be very helpful
to hear how you handle this.


Bill Moseley
moseley at hank.org

More information about the thelist mailing list