Laravel refresh page takes up to 4s to load the whole DOM - laravel

I'm new with Laravel's framework, so correct me if i'm mistaken.
I have set up some templates with some assets (css and js) in its corresponding folder:
SASS and JS goes inside resources/sass and resources/js respectively, which then gets compiled into public/css and public/js
Views go into resources/views, and then i have set up some routes inside routes/web.php
If you want me to add some more information i can for sure add it.
Image of console network debugging
Please, ignore images time load as I dont care the loading of them cause they load after DOM.
What I'm asking here is: why is every .css file or .js file taking more than a second to load?

Solution found
Seems like xDebug was causing strong loads in my page, commenting it fixed it.

Related

Blazor Interopt Js in separate project doesn't refresh, even by removing cache, bin/obj

This is a cache issue I guess. Let me explain,
I have a .net6 blazor project (client server and shared project) which as a referenced project call ReactorBlazorMapbox (Razor library), which is in charge with JsInterop to play with mapbox js.
Code in progress, but works great yet. Display a map, display popup...
The ReactorBlazorMapbox project has its own JS file, called MapboxInterop.js. This file is loaded in ./_content/ReactorBlazorMapbox/MapboxInterop.js
This way, no need to reference the file in the client projet. It's embeded. Great.
My problem is, when I modify this file, nothing happend. Clear cache CTRL-F5, manualy clearing cache using inpector/Application/Cache/Delete (or local/session storage). I also removed bin/obj, clean solution, re generate projects on C# side.
My MapboxInterop.js in the browser does not refresh. (using inspector/Source)
I had to rename it MapboxInterop2.js and change my link in the import, this way it works. At least one time. But add a new file each time modification is done in this file will be time killer...
I found a work around, instead of using a embeded js interopt file from the side project, I put this one in the Blazor Client /wwwwroot/js path and add this line :
//load js from client projet path
_Module = await _JsRuntime.InvokeAsync<IJSObjectReference>("import", "./js/MapboxInterop.js");
instead of
//load js from this project
_Module = await _JsRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/ReactorBlazorMapbox/MapboxInterop2.js");
this way, when re running the site with VS2022, the file in cache is refreshed.
If someone has an idea so the same thing happen for a embed project js...
FCK me :)
I forgot to check "disable cache" checkbox in the browser inspector.
But, there is a cache difference between those two files. (client vs project)...

How do I solve the nuxt static image caching problem?

I have a static image cache problem in the browser.
I am displaying an image from the static folder in my project and when I change the content of the image without the image name change, the browser cannot detect it.
I want Nuxt to cache this image based on the modified date, or somehow detect this change and display the image over. is there a solution to this?
Actually nuxt does this out of the box - at least in the production builds and when you load the images from the assets folder.
For assets in the assets folder, webpack generates a hash and appends it to the filename at build time. If the content of the image changes, the hash changes as well. This way the browser knows when to load the updated image from the server.
Check here for reference: https://nuxtjs.org/docs/directory-structure/assets/#webpack
The static folder is not processed by webpack by default and therefore the hash is not added to the filename.
So try to make use of the assets folder, then the caching problem should be solved.

mcamara/laravel-localization is changing my assets (css, js, others) route

I'm using mcamara/laravel-localization on my project everything is working perfectly, but when I'm trying to a layout (ressources/views/layouts) to include all my pages the localization is also affecting my assets, the css ans js files are not loading, it's giving localhost/en/assets/css/style.css instead of localhost/assets/css/style.css. What should I do?
One crazy thing is if I don't use a layout I'm not getting that problem. Help me please.

How to check why there is a lag loading the stylesheet for website

I'm building a website and there seems to be a lag with loading the stylesheets. It seems as if the page loads without the stylesheet and then a few seconds later (depending on the network speed) the entire page loads. This would of course be a bad experience for the users. I can't figure out what stylesheet is not loading quickly to cause this delay. Here are the links.
http://www.hotelzoo.com/sign_up?hotelregister=true
http://www.hotelzoo.com/sign_in
I'm coding this using Ruby, Heroku, and AWS if that helps.
You're importing the CSS in the bottom of the page, together with the JavaScript but it shouldn't be there. Always import the CSS inside the <header> tag at beginning, this way the browser will load the source files before rendering the page.

How to add an external stylesheet/js file to a UIWebView without having it stored?

I want to change some CSS properties and HTML content from a random web, so I download and save the html file in the device and load it in a UIWebView to modify it.
The problem occurs when the html has referenced stylesheet/javascript files and they aren't loaded in the UIWebView.
Is there a way to access automatically to these files?
I've thought of getting the path through javascript and add the web url to it, and then download... but first I'll have to check if the path is relative or absolute and that...
Is there an easy and clean way to do this?
(I have the same problem with the images that are not url linked...)
Any idea would be appreciated :)

Resources