CSS changes not updating on site - css

Today I started changing some CSS on a Symfony (2.6) project. I added some styling to my newly created css file and everything was working fine. My problem occured when I went to add another style and nothing happened. I checked the dev window and couldn't find my styles anywhere. I've deleted the cache multiple times. Im using Symfony with a vagrant box. If I open the css file in the url it is filled with diamond/question marks and my first style entry is still there. I checked and the encoding is set to UTF-8. Ive never had issues like this with css, does anyone know what the problem could be?
I am using Assetic to include the style sheet within the project like this:
`<link href="{{ asset('css/print_production_report.css') }}" rel="stylesheet" type="text/css" media="print" />`
So to show you whats happening I'll start from the beginning. I had this stylesheet (ignore the error):
And upon checking the browser I still have:
Now when I add some random text or css to my stylesheet as so:
You will see that all my changes are being converted into these diamonds:

I think this issue of caching files and replacing them with the unicode 'REPLACEMENT CHARACTER' (�) has to do with sendfile. Turn sendfile/EnableSendfile off in nginx/apache.
Related question is here: yeoman and angular utf8 issue and caching

Insert
#charset "utf-8"
at the top of your file and make sure you've saved the file in UTF-8.
Helpful link

Takie this lower text and comment it, i mean use
//comment blabla
In your css file.

Related

How to compile css file

I've seen this on a site:
<link rel="stylesheet" href="http://blablas.com/built/assets-styles.css?v=12355" />
which need to be underlined assets-styles.css?v=12355"
How to compile css file as above?
is it possible with less or sass?
[update]
And How about this?
<link rel="stylesheet" href="https://blablas.com/built/assets-201501-35b4b2bf0e75bb40f98d111b2d97951d.css">
CSS files are not to be compiled.
The reason the URI parameter is there could be it is not really a CSS file that's called, but a PHP engine (with mod_rewrite) that returns a CSS file based on the given parameter.
Another reason to use parameters is to force web browser to fetch the stylesheet again when necessary.
That has nothing todo with Compiling CSS! You use it for Cache Control. Everytime the CSS File gets changed they just need to change the numer and the new version gets requested.
In the 1st Link you posted ist a GET Variable therefore ist more likely to be vor some inernal Processing

codeigniter website on a host- CSS changes does not change front end elements

My site is in a Host. (Not localhost)
Framework: CodeIgniter.
Changes made using CSS: Flot chart's legend
I did changes to front end using Chrome tools/developer tools.
I can see all the changes I made instantly.
I FTP to the site, downloaded the CSS file, did necessary changes (same as chrome developer changers) and uploaded the CCS file.
I access the site, but I cannot see the changes I made using CSS file.
Check if your hosted CSS contains the latest changes
If CSS is ok try to open chrome dev tools and inspect the element that you are trying to modify. Scroll through the CSS applied to that element and check if your styles are there.
If you didn't find any of the styles that you are tring to apply to the element probably you misspelled the selector name. Remember to check .class #id
also, in order to ensure that your CSS files are not cached suffix your php files like this
<link href="/stylesheet.css?<?php echo time(); ?>" rel="stylesheet" type="text/css" /&glt;
EDIT
tip above also works for any resource! (css, javascript files, images ...)
Try Ctrl+F5. It's hard refresh
change the name of the css file so there are no cache issues and then check. if that does not work then look at your source code and copy paste the address of the css file to make absolutely certain you have the link correct.
I think your CSS is still cached so have a Look at this popular question: How to force browser to reload cached CSS/JS files?
There are some solutions how you can force your browser to refresh the CSS or js.
The easiest answer you will get is using something like this:
/styles/screen.css?v=1234
If you did a change all you have to do is to +1 the counter!
In PHP you van also use this:
<link rel="stylesheet" href="mycss.css?v=<?php echo filemtime('mycss.css') ?>"/>
It's like an autocounter using the timestamp of the CSS file.
In the DevTools Settings (F1) or in the Network panel (depends on what version of Chrome you are using) tick the Disable cache (while DevTools is open) checkbox. If caching is your problem, it should get fixed.

css in firefox and ie is rendering old css file...chrome shows new css just fine

For some reason I can't get the new css to be used in firefox or ie's browser.
I am using php to consolidate all the css into one file, then output it like so:
PHP file:
header('Content-type: text/css');
readfile('layout.css');
readfile('a.css'); //jqueryUI
Here's how I call it from the HTML side:
<link rel='stylesheet' href='stylesheet/css.php?v=1327523109' type='text/css' />
The "v" querystring parameter is simply a php time() function from a tip I got on another search for the problem. Hoping the time() would trick the browser into not loading the cache version, but it is not working and still loading the old css.
When I look in firebug's css file it shows the old css file. However if I directly access the .css page through the url, the output to the browser screen shows all the new css code.
if I render the same page in the chrome browser it shows the new css without any problem...but ie and ff show the old css.
I don't understand what's going on and how to fix it. Can anyone help me?
ctrl + shift + del In both browser will allow you to clear your cache, cookies, temp files, and more via nice checkboxes.
Perhaps the css file is cached in the browser. Try CTRL+F5. If that doesn't work try clearing the cache, if that doesn't work try a reboot. :D
I tried CTRL+F5, Clearing the cache, rebooting...none of that worked right. Then I decided to change the ordering inside the css.php file for the readfile() functions. Once I moved the ordering around it triggered the new css to load. I don't know exactly why this worked, but now the new css loaded.
Decided to answer this here in case someone else comes accross a similar problem and the traditional cache clearing doesn't fix it.
Here is the trick, instead version, just use the PHP filemtime() Function to show your last modified file.
<link rel='stylesheet' href='stylesheet/css.php?<?php filemtime('stylesheet/css.php'?>' type='text/css' />
So every time you modified CSS file, the browser will know what file must be loaded.
hope it help..

django css file cached

I'm having a css file and i want to modify it to fit my needs.
The problem is that it seems to be cached somewhere, as i just cannot see the changes, no matter what i do in the css file.
I am sure i am pointing to the right file, as by now i'v modified in it, and it worked.
Is there any setting so that i can turn the cache off?
Thanks!
As pointed out in this article http://www.wkoorts.com/wkblog/2009/07/12/css-auto-reload-with-django-templates/, you could force django reload your css file by using a parameter in your css link :
<link rel="stylesheet" type="text/css" href="/site_media/css/style.css?{% now "U" %}" />
This is a timestamp which takes a different value every second, so you could even reload your css second every second if needed!
Just go into your site, view source, and copy the link to your CSS file. Verify the link, verify it's being modified. Refresh the CSS file manually via your browser to get the latest.
This isn't a Django issue.
Did you try appending a datetime stamp to the end of the request? I know some frameworks do this to .js and .css files automatically to prevent caching.
Instead of using complicated solutions you can add extra parameter to your includes in the templates.
For static includes:
<script src="{% static 'js/polls/polls.js' %}?version=1"></script>
For direct includes:
<link rel="stylesheet" type="text/css" href="/site_media/css/style.css?version=1" />
Note the ?version=1 in the code. Every time you're modifying the file, change this version in the template, so browser will be forced to reload the file.
Of course you can use even now as suggested by #rom, but if your static files are not being changed very often, it's not the smartest idea to don't use cache at all.

css file not getting updated

the font of the content of my facebook app keeps getting italicized even when i've removed the italics from the css file. if i make minor changes in the css file and upload it to the server, the firebug shows the unedited previous css file and hence, the app keeps showing unformatted content. what exactly is going wrong here?
i made a new css file and copied the contents of the previous css exactly as it was, and i linked it in all the files which require css. but when i upload these files to the server, facebook canvas doesn't show any css at all. i replaced the css filename with the previous one, and it works. why is this?
Actually it looks like facebook is currently experiencing some weird problems with styling. It doesn't cache any new styles, only displays what was previously cached (from yesterday). If you provide a new stylesheet url it will not be able to pull it up (like that url doesn't exist).
During normal conditions what others already suggested should work.
Facebook does like to cache things. Persistently. I don't know why the new file wouldn't have worked, by I can recommend 'spoofing' your css filename with a spurious querystring variable, and incrementing it each time you make an update.
eg
href="my_css_file.css?x=1"
Sounds like the browser is caching your CSS file, which is why even Firebug sees the older version.
There are numerous ways you can prevent the browser from caching your CSS file during development (once in production mode, you probably want it to remain in the cache). The most common technique used by web frameworks like Ruby on Rails is to append a random query string to the URL, like so:
<link rel="stylesheet" type="text/css" href="style.css?96234987" />
...but the trick is that it should be different every time, so the browser thinks it's a different file.
Here are links to a simple trick for PHP, a JSP example, and other possible methods.
According to Include files on facebook developer wiki:
Stylesheet includes are cached automatically by Facebook. Just include a tag like:
<link rel="stylesheet" type="text/css" media="screen"
href="http://yourapp.com/stylesheets/style.css?v=1.0" />
Increment the version number upon each change to your style sheet, as specified above.

Resources