Does Google's mod_pagespeed provide auto versioning of CSS and js files?

504 views Asked by At

https://developers.google.com/speed/pagespeed/module/ This link doesn't talk specifically about CSS and js auto versioning but I read somewhere that this module can be used for auto versioning of CSS and js files. Would like to confirm about this.

Please let me know if auto versioning is part of google's mod_pagespeed module and if it can be used with my Apache tomcat 8 server ?

Any references to the above functionality will be greatly appreciated.

1

There are 1 answers

0
doz87 On

I have done some testing and from what I can see, the answer is no, well at least no in the sense that it won't auto version immediately after a change.

For reference, I'm running Apache 2.4.10.

From my tests, I had 4 javascript files that I was monitoring, these files were being optimised by pagespeed and the resulting file had a hash of ...pagespeed.jc.bFZBaW2xkN.js.

Within this file, it also gives hashes for each file it combines.

var mod_pagespeed_64gxmrG5cP = ...
var mod_pagespeed_r8BXvaG1ZV = ...
var mod_pagespeed_86DySW9yKu = ...
var mod_pagespeed_FAqlx5ADkk = ...

I found that I would make changes to files but nothing would change until I did a hard refresh (using Chrome).

When hard refreshing, I noticed the main file name ...pagespeed.jc.bFZBaW2xkN.js hash would update and looking within the file showed the change but that the inner hashes that represented the combined file were still the same.

I ended up implementing my own auto versioning in a php function that just appends the file modified time to the end of the file as a query eg. somejavascriptfile.js?v=0123456789

Now if I touch the file, the main combined file updates its hash but the inner hashes also update.

Hope this helps anyone else out there wondering the same thing.