thomasloven / lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
MIT License
1.05k stars 169 forks source link

Lazy Load Resources #299

Open efaden opened 9 months ago

efaden commented 9 months ago

I have a bunch of different resources I am trying to use on different dashboards. Tablets vs phones, etc. Normally the interface lazy loads the resources, but card mod seems to change this behavior to force everything to load. The issue with this is that as the number of resources references increases the load time increases as well causing issues. It's there a way to keep lazy loading?

thomasloven commented 6 months ago

What resources? What makes you think card-mod forces anything to load?

efaden commented 6 months ago

https://community.home-assistant.io/t/custom-element-doesnt-exist-but-loads-a-few-seconds-later/266349/2

See that. I read it somewhere else also. Basically all my JavaScript files download and seem to try to load even if the dashboard doesn't use them. Not a big deal on most devices but it's killing my tablets.

Is this not true?

thomasloven commented 6 months ago

No. It's not.

thomasloven commented 6 months ago

All custom resources are always loaded immediately. For the core frontend functionality, things are loaded as they are needed. And there isn't even any way to force everything to download as far as I know.

efaden commented 6 months ago

Alright. Good to know. Sorry for opening this then. Several places implied card mod was changing the behavior some how.

I wish there was actually a way to use different resources per dashboard.