When running the app assets are lazily loaded
the exception to this is html files and theme.css, both of which are eagerly loaded.
(note this is different to the ide where all asset files are loaded)
The anvil-extras loading functions are a good way to go.
Another way you might take advantage of assets being lazy loaded is to include script tags in native libraries with the src attribute and either the async
or defer
keyword.
The async
keyword loads the src in parallel and won’t block the loading of the page
The defer
keyword waits until the page has loaded before loading the script
Some more info available at MDN