grails - How to force browser to not cache css file when the css file changes? -


i have base layout file used in of views. in base layout require module using grails resources plugin.

<r:require module="core"/> 

the modules defined in conf/applicationresources.groovy file as

modules = {     core {         resource url: '/css/main.css'         resource url: 'js/application.js'     } } 

now here problem. make change main.css file , build app. change doesnt reflect in browser. update if view source , click on css file , refresh css file. browser caches css file. have tried appending version above code like

modules = {     core {         resource url: '/css/main.css?version=2'         resource url: 'js/application.js'     } } 

but doesn't work. when @ generated css link tag see css file

<link href="/app/static/bundle-bundle_core_head.css" type="text/css" rel="stylesheet" media="screen, projection" /> 

so makes sense why version not working. have tried last resort

<link href="/app/static/bundle-bundle_core_head.css?version=2" type="text/css" rel="stylesheet" media="screen, projection" /> 

and css file updated. cannot use solution since hack.

so question is there way css file automatically update when make change css file while using grails resources plugin.

resources plugin

http://grails.org/plugin/resources

the grails version using 2.2 , resources plugin version 1.1.6.

if use apache webserver, can use .htaccess file. specifying file concerned, won't cached.

<files main.css> fileetag none header unset etag header set cache-control "max-age=0, no-cache, no-store, must-revalidate" header set pragma "no-cache" header set expires "wed, 11 jan 1984 05:00:00 gmt" </files> 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -