kofhearts
kofhearts

Reputation: 3794

Changes made to web-app/css not reloaded in browser?

I am using grails 2.2. I have few css files in web-app/css folder. When i make change to these files and run the application or deploy the application the changes made to these files are not reflected. I need to explicitly load this file in the browser and click on refresh button in the browser only then is the new css file obtained. It is clear that the css files are being cached which is preventing the new files to show up. Is there a fix to this problem? How can we force the browser to detect changes in css files and reload it if they are changed?

I appreciate any help! Thanks!

Upvotes: 0

Views: 270

Answers (1)

Amritanshu Pandey
Amritanshu Pandey

Reputation: 233

The way I workaround this problem is by making a change in HTML page evey time I update JS or CSS.

This ensures that latest JS or CSS is loaded by the browser.

You can add a version field after the name of your CSS or JS file while including those in HTML

<link href="/site.css?version=3" rel="stylesheet" type="text/css" />

Just update the version number in HTMl every time you make changes in CSS.

Upvotes: 1

Related Questions