Browser caching style sheet


I have a custom theme for my application. After I add/change css definitions and redeploy my application, often the browser uses the old styles.css file that is cached. I get around this with other frameworks by appending an arbitrary value to the URL, i.e. …/styles.css?d9wo6hd7iue

How can this problem be solved in Vaadin?



Are you using Chrome? Chrome aggressively caches CSS files. I tend to find that you need to do hard refreshes (e.g. Ctrl+R) - sometimes several - make it recognise any changes to CSS.

Other than that, though, I’ve not found any “generic” caching problems with CSS and Vaadin.



Yes, I’m using Chrome, but interestingly I don’t have as much of a problem with it as my coworkers do with other browsers. I’m familiar with the hard-refresh workaround but I can’t expect my clients to do this.

I’ve had a look at the source code and the styles.css filename is hard-coded so I don’t see any opportunity to add a random element to the URL. I’m currently considering adding random stuff to the theme name and creating a sym link directory on the file system to match. Not pretty.