I’ve got an app written with Struts/Tiles/JSP that I’m adding a GWT app to. The non-GWT portion of my app handles css caching by actually writing out the css file with a version number taken from my svn repository attached, like this “styles.css?svnbuild=12345”. That way I can tell the browser to cache those css files forever and when I deploy a new version all my users download it immediately.
Now I’m moving on to the GWT app and I love how it uses “longmd5sum.cache.css” as the filename so I can still tell the browser to cache it forever. The problem is that the css files associated with my theme, like “gwt-standard.css”, don’t have a strong name and don’t have my svnbuild parameter attached. Whenever I deploy a new version of my app, users are still seeing the old version of the css which makes it look wrong.
Has anyone figured out a best practice for handling caching of gwt theme css files? Is there a way I can append an svnbuild parameter or something similar when appending the css to the document?
Ok. So after I posted this I dug into the GWT source code and found some links about creating a GWT custom linker.
http://development.lombardi.com/?p=29
http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html
Here’s how I solved it with my own linker. First I made a linker class that extends the standard IFrameLinker:
After that it’s just a matter of telling your module to use your custom linker. In your module.gwt.xml file:
Just tried it out and now in my nocache.js file it outputs a new timestamp every time I compile. My users can cache the css file forever and they will download a new one automatically whenever I deploy a new version of the app.