3

I'm working on Laravel framework,

I have changed my bootstrap.min.css from v3 to v4 but it's not updated in the browser

I have tried:

php artisan cache:clear
php artisan route:cache
php artisan config:clear
php artisan view:clear
rm -rf bootstrap/cache/*/*

and I deleted the files from storage/framework/views but still, the CSS is not updating.

Can anyone please help me?

Udhav Sarvaiya
  • 8,317
  • 11
  • 53
  • 61
Sharmila
  • 31
  • 1
  • 4

3 Answers3

9

Just add a query string after end of the css file.Then it will not use cached file css. Like ?v=1,?v=2 or any random string.

Example

 <link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/stackoverflow/primary.css?v=1a040064279b" >

you can also use php function

?v=echo time();
Akash Kumar Verma
  • 2,954
  • 2
  • 14
  • 27
5

For custom CSS file in laravel, use time() function by the following method:

<link rel="stylesheet" type="text/css" href="{{asset('css/style.css?v=').time()}}">

Remember ?v= is just used for getting value by the time() function that will generate random number every time when you refresh the page.

General Grievance
  • 4,259
  • 21
  • 28
  • 43
Danish Kazmi
  • 61
  • 1
  • 6
0

This is caused by Chrome's cache. Just follow these steps:

1, Control+Shift+I

2, Click Network > Tick Disable cache

enter image description here

3, Reload Chrome!!

Trinh Hieu
  • 309
  • 3
  • 6