Yii 1 define timestamp to clear assets files - caching

Now exist problem, because I modify css or js files users must clearing clear their browser cache to get newest changes. How to prevent this ? I think, that best way is define assets timestamp, Yii have something special for this ?

I not understand for what is it. After deploy new version static to server you can clear assets folder. After this will be created new assets from last version files.

Related

Updated Image file but not reflecting on Live server in laravel 9

I'm new with Laravel and I made web application but when I updated the image file or some css code it will not reflecting on live server.
I tried:
Route::get('/check',function(){ Artisan::call('cache:clear'); Artisan::call('optimize:clear'); Cache::flush(); });
but this is not working.
I just want to reflecting updated image file or css file when I update it.
"it will not reflecting on live server"
This is the bit that worries me being you've tried the cache clear commands. Laravel will mostly serve up the current assets, there are of course exceptions!
Laravel octane; If you're using this package then php artisan octane:reload
Other sources for these sorts of errors to check first would be
Browser cache - try renaming the files or adding a query string to their lings.
CDN cache - lots of people use cloudflare as a CDN and DNS, make sure development mode is turned on and you've flushed the cache there.
For the most part, just adding a query string and/or changing the name should be enough to prompt a fresh download.

Laravel Vapor - Assets (logo) on maintenance mode page

According to the docs we are able to put a 503.html document inside the root of our Laravel project.
You may customize the maintenance mode splash screen for your application by placing a 503.html file in your application's root directory.
I would however love to be able to put one or more assets on this page (for example our Logo) to make this page better more personal. Laravel Vapor automatically uploads your static assets to cloudfront, which is not a problem if you're using the asset() helper. However, are there any solutions already being made? I can't find any.
Is there anyone who has created a solution to make this happen?
With Vapor every time you deploy all the assets get a new cloudfront url. This is mostly fine for js and css which we change often. Images, logos etc do not change much.
Better to make another bucket on aws and hard code the path the image file in your 503. Doesn't need to be deployed every time. Your users browsers can cache it for as long as you set it in the bucket.
I'd like Vapor to only change asset urls if the files have changed but so far that is not the case.

Change Laravel Web Tinker Public Files Directory - Prevent 403 Error on Saving

I love this little library - so helpful.
However, it places some of its css and js files in a vendor folder inside the public directory of Laravel. I've got a Vendor class and paths in several apps and so, when saving a new Vendor, it redirects 403 Forbidden due to the conflicted vendor folder in the public directory.
I can't go back and refactor just for this to work, much as I like it.
It comes with a publishable config file, but I don't see an option to change the path to these files to a location outside the vendor folder. I don't want to make changes to the Spatie files, as this would just be overwritten upon next update.
Am I missing something easy here? Any way to get around this?
There isn't currently a config setting that allows you to control this.
The line causing you grief is here - https://github.com/spatie/laravel-web-tinker/blob/master/src/WebTinkerServiceProvider.php#L29. It publishes the compiled assets, as you say, into the public/vendor folder.
If you do not want to refactor your existing work, you can:
PR/fork a change to add this as a config setting
Manually change it on your end (although this could easily break if you republsihed the assets ever

Laravel FileZilla upload/download

Is there a proper explanation as to why when I'm either pulling the complete project from the server, or pushing it on server, views don't get updated? I always have to manually go to the resources folder and transfer views after everything has already uploaded/downloaded.
The solution is to clear your cache like stated in the comments.
php artisan view:clear
The reason why this is happening is because by default the caching is set to File. Which means that the view-cache is stored in files. When you upload everything the old-cache is uploaded. The files are stored in storage\framework\views
If you upload a single folder, laravel notices a change and the cache is busted.
PS: it is recommended that you use git for this kind of stuff, Laravel has .gitignore files to prevent this kind of behavior.

In an external assets folder the best place to put libraries for CodeIgniter 2.x?

when I last used CodeIgniter it was version 1.x and I read an external assets folder for css, js, and images was the best way to handle things. I wanted to know if that is the correct way to do things in 2.x. I found this on SO but it didn't address it directly:
Assets in codeigniter
The other SO entries were too old to address 2.x.
Thank you.
As long as they are both publicly accessible then there is no difference between
application
...
system
...
assets
css
style.css
images
image.png
and
application
...
system
...
css
style.css
images
image.png
Depending on your .htaccess file you may need to make a change but CodeIgniter doesn't require you to use any specific scheme for storing assets.

Resources