Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Issue with cached assets

Started by Muut Archive 9 years ago · 6 replies · 529 views
9 years ago

Hi,
I have a problem with reloading css assets in a theme, no matter what I do, changes to the css file in my theme don't appear in the browser. I have disabled caching, twig caching, restarted webserver, clear opcache, deleted whole cache folder, but to no success.
I am running grav in vagrant on nginx with php 7.1.
The problem was mentioned on this forum more than once, but I tried everything suggested there and even reinstalled whole grav.

I am pretty stuck so thanks for any suggestions.

9 years ago

Can this be a problem of client-side caching of the CSS? Try opening the browser dev tools, with the option to disable cache.

9 years ago

Thanks for your suggestion, but this doesn't work either, i tried multiple different browsers, cleared cache, disabled it but no luck. When I check the network tab in chrome dev tools, it shows it has fetched the main.css file but somehow it has old content in it, not the new one. If I navigate browser to the location of the css file it shows the old content too.

9 years ago

I am sorry but it is not, I have it in vagrant on my laptop. I am trying to go through the page loading with xdebug maybe I'll be lucky.

9 years ago

I finally figured it out, the problem that in the theme I am using the main.css file is not added through assets.add() function but with <link rel="stylesheet" href="main.css"> tag so it completely circumvents the grav core logic and stilll gets cached somewhere (I still haven't figured where). Thank you very much for your support @flaviocopes.

9 years ago

It seems I was a bit rash with the above solution, because it worked only for the first edit of that file after that the error repeated. After extensive googling I finally found the real culprit, it is a bug in vagrant with virtual box provider that breaks nginx sendfile function. So for development you should disable it in /etc/nginx/nginx.conf. With that you are ready to go.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1326 9 years ago
Archive · by Muut Archive, 9 years ago
2 921 9 years ago
Archive · by Muut Archive, 9 years ago
2 4050 9 years ago
Archive · by Muut Archive, 9 years ago
1 2928 9 years ago
Archive · by Muut Archive, 9 years ago
3 1107 9 years ago