CodepadME / laravel-tricks

The source code for the Laravel Tricks website
http://laravel-tricks.com
MIT License
966 stars 298 forks source link

fixed asset paths #75

Closed emreyo closed 9 years ago

emreyo commented 9 years ago
msurguy commented 9 years ago

Actually, we use a cache-busting mechanism to make sure that the browser downloads the most recent version of the css or js files. Take a look at https://github.com/CodepadME/laravel-tricks/blob/master/public/.htaccess , specifically the "Better cachebusting" section.

In other words, when you release a new version of CSS or JS files, you have to rename them by changing the number according to the version of your site (1, 2, 3, etc).

In the future this will be done automatically and in much better way with Gulp.js.

emreyo commented 9 years ago

But can't you append

?v=2

or something like that for this purpose? This does not work on local.

stidges commented 9 years ago

Are you running on Nginx (Homestead)? If so, make sure you have this in your Nginx config:

location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif)$ {
   try_files $uri $1.$2;
}
emreyo commented 9 years ago

Thanks. I wasn't aware of that. I use styles.css?v=2 for this purpose. Thank you very much for the info.