This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello, I've been hit with this really annoying bug where whenever I update my css stylesheet, it will not update if I keep refreshing the page, it only updates if I log out of the backend and log back in, then it will show the changes. I do believe my layout is fine:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ this.page.meta_description }}">
<meta name="keywords" content="{{ this.page.meta_keywords }}">
<meta name="author" content="{{ this.page.meta_author }}">
<title>{{ this.page.title }} | {{ this.theme.site_name }}</title>
<!-- core CSS -->
<link rel="stylesheet" type="text/css" href="themes/ferrorods/assets/css/bootstrap.min.css">
<link href="{{ [
'assets/css/main.css'
]|theme }}" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Raleway:400,500" rel="stylesheet">
</head><!--/head-->
<body class="homepage">
{% partial "nav" %}
{% page %}
<!-- Scripts -->
<script type="text/javascript" src="{{ 'assets/js/jquery.js'|theme }}"></script>
<script type="text/javascript" src="{{ 'assets/js/bootstrap.min.js'|theme }}"></script>
<script type="text/javascript" src="{{ 'assets/js/jquery.isotope.min.js'|theme }}"></script>
<script type="text/javascript" src="{{ 'assets/js/main.js'|theme }}"></script>
{% framework extras %}
{% scripts %}
</body>
</html>
My stylesheet is just a normal css stylesheet, nothing special about it. I know my css is correct because when I do log out and back in it works. Is there any way to fix this?
The problem is right here:
<link href="{{ [
'assets/css/main.css'
]|theme }}" rel="stylesheet">
By putting your stylesheet in square brackets, that means that it will be run through the asset combiner / compiler, which will result in a URL like /combine/5dd2624cb90bc9ada6ff5776e3d2f084-1484373640. This URL will be cached server side so that the server doesn't have to recompile the assets within for every single request.
In your case, you have just one asset in that line, which means you don't want the Asset Combiner to combine any assets, and your one asset is a CSS file, which means that it doesn't need to be compiled at all. So, to fix your problem, simply change it to:
<link href="{{ 'assets/css/main.css' | theme }}" rel="stylesheet">
instead.
As a note, if you do run into the problem in the future where your assets are cached and you want them to regenerate, then you can run php artisan cache:clear
which will clear the cache for the asset combiner / compiler. If you're compiling assets like LESS or SCSS files though, simply editing a file on the top or second level should automatically trigger cache recompilation.
LukeTowers said:
The problem is right here:
<link href="{{ [ 'assets/css/main.css' ]|theme }}" rel="stylesheet">
By putting your stylesheet in square brackets, that means that it will be run through the asset combiner / compiler, which will result in a URL like /combine/5dd2624cb90bc9ada6ff5776e3d2f084-1484373640. This URL will be cached server side so that the server doesn't have to recompile the assets within for every single request.
In your case, you have just one asset in that line, which means you don't want the Asset Combiner to combine any assets, and your one asset is a CSS file, which means that it doesn't need to be compiled at all. So, to fix your problem, simply change it to:
<link href="{{ 'assets/css/main.css' | theme }}" rel="stylesheet">
instead.
As a note, if you do run into the problem in the future where your assets are cached and you want them to regenerate, then you can run
php artisan cache:clear
which will clear the cache for the asset combiner / compiler. If you're compiling assets like LESS or SCSS files though, simply editing a file on the top or second level should automatically trigger cache recompilation.
I did this then cleared the cache but I am having no luck, my css file is still not updating. I'll keep trying some more to see if I can get it to work.
Also check if you have a CDN between you and your server that's caching the file, or if it's being cached locally on your device.
alxy said:
Are you in
debug
mode? If not, enable it. It should disable some of the caching.
I wasn't, but I figured out the issue. I had to turn on Cloudflare development mode, it was caching it.
1-6 of 6