1

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
  • 6,939
  • 10
  • 42
  • 51
Sharmila
  • 11
  • 1
  • 4

2 Answers2

4

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,345
  • 2
  • 9
  • 25
1

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.

Calculuswhiz
  • 3,244
  • 9
  • 21
  • 35