Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject:
PostPosted: Sun Aug 29, 2010 5:42 pm 
Offline
Senior Member

Joined: Wed May 13, 2009 1:18 am
Posts: 681
jlynch wrote:
Sorry, I kind of thought this was implied as it had already been discussed

Fair enough - I thought I checked the thread and only found references to renaming the files, not changing the content, though I agree it is implied. Just expected to see it as a step when the process was being described step by step.

Quote:
The way you do it is going to vary utterly based on how you're doing your site but yes, in your root template (Or each page where they're referenced), you need to update the link to use the new number...

Hmm, but in that case, why go through all the hassle of renaming the files? Using a query parameter (e.g., foo.css?v=###) where ### could be the svn repository version means there's nothing to change on the server filesystem, nor any rewrite rules necessary. And if your site is dynamically generated, the reference could be inserted at render time, so no checkout post-processing ever needed (just an "svn update" on the server).

Just as I was doing my final preview of this post I saw your edit and the comment on query tags, so no answer required, but I figured I'd leave a separate opinion in this post, since I'm on the other subjective side in terms of liking the look of a version parameter than a new filename (I guess I see the version as a temporal dimension of the same named file).

Though as an aside, I am interested in experiences where any caches break such approaches. At worst, it may prevent some intermediate caching due to overly conservative caches not caching anything with a query string. Certainly a lot more than css/js would break through any cache not considering query strings as part of the identity of a cached element.

Quote:
I thought that was getting a bit involved and messy to be putting in here, I'll update the explanation I guess. :)

No biggie - just an extra step of "update content to match" would probably be more than sufficient.

-- David


Top
   
 Post subject:
PostPosted: Sun Aug 29, 2010 7:20 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
There's a super easy way to do this without relying on VCS integration such as post-commit hooks. (Everyone should be using some sort of VCS, but anyway.)

PHP:
Code:
$timestamp = filemtime("example.css");
$display_filename = "example-$timestamp.css";
echo '<link rel="stylesheet" type="text/css" href="' . $display_filename . '" />';


This will append a 10-digit Unix timestamp to the end of your CSS filename, and this value will change if and only if the CSS file gets modified. Now go ahead and create a rewrite rule that strips that hyphen and 10 digits from the end of your CSS filename.

Note: Unix time will become 11 digits sometime around the year 2300.


Last edited by hybinet on Sun Aug 29, 2010 8:43 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Sun Aug 29, 2010 8:27 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
hybinet wrote:
Note: Unix time will become 11 digits sometime around the year 2300.


:o I better get ready for that! :P


Top
   
 Post subject:
PostPosted: Sun Aug 29, 2010 8:44 pm 
Offline
Senior Member

Joined: Wed May 13, 2009 1:18 am
Posts: 681
I suspect the signed/unsigned 32-bit rollover in 2038 is going to be more "exciting", not to mention something we're more likely to be alive for :-)

-- David


Top
   
 Post subject:
PostPosted: Sun Aug 29, 2010 10:16 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
I suspect in 28 years we'll all be running 64 bit systems so that shouldn't be a problem! Of course someone...somewhere...in a deep dark hole will still have a 32 bit system like those ye olde systems that still run on cobol and the like.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group