CrazyCoder
CrazyCoder

Reputation: 2378

CSS changes are not reflected even after changing version, hard refresh and clearing cache

I have an Angular application with CSS in it.I have recently changed the CSS and deployed it on server but it is not getting reflected in the client machines.

I have done the following things:

  1. Clear cache and did a hard refresh (Ctrl+f5).
  2. Changed the version number of the CSS file and redeployed it.
  3. Opened developer tools and disabled Cache and reloaded.
  4. Pressed F12, go to source and checked the CSS file if new changes are getting loaded. New changes are there.

When I opened the web application in a new machine, the new changes are getting reflected.

When can be the possible reason for CSS not getting reflected even after checking all the above. Is there anything which I'm missing?

Upvotes: 2

Views: 3366

Answers (5)

Ankit Tiwari
Ankit Tiwari

Reputation: 4690

I cleaned angular cache and it worked for me

ng cache clean

there're more if you do

ng cache --help

you'll get list of options like disable, enable cache

ng cache clean    Deletes persistent disk cache from disk.
ng cache disable  Disables persistent disk cache for all projects in the workspace.                     [aliases: off]
ng cache enable   Enables disk cache for all projects in the workspace.                                  [aliases: on]
ng cache info     Prints persistent disk cache configuration and statistics in the console.

Upvotes: 0

NidhinSPradeep
NidhinSPradeep

Reputation: 1304

You can disable cache in development tool in chrome. Go to Developer tool in Chrome by pressing F12, Network-> click on Disable Cache

I faced similar issue. This helped me. Hope it might help some one

Upvotes: 0

Akber Iqbal
Akber Iqbal

Reputation: 15031

is it a PWA (progressive web app)... ? in which case the data is served by service worker and not freshly fetched.

Go to

  • Chrome developer tools (press F12)...
  • Click on Application tab on
  • the left navigation, click on "Service workers" and 'unregister" service workers...
  • going on the next option in the left navigation, click on "Clear storage"...
  • click on the "Clear site data" button on the right zone restart Chrome and check with Ctrl+shift+R

if you're using a CDN, you may have to purge the cache for this particular CSS file from there as well.

Upvotes: 1

UI_Dev
UI_Dev

Reputation: 200

Please clear the browser history of the application complete from begin and perform hard refresh and then try to login to your application

Upvotes: 0

lucky
lucky

Reputation: 318

Make hard refresh (Ctrl+Shift+R) or go to view page source and the open css file from it and make it refresh and then again make hard refresh...Your problem will be solved

Upvotes: 0

Related Questions