Required JS Assets
Dynamic Maps Only
Combined, they produce an HTML snippet similar to this...
<link href="https://api.mapbox.com/mapbox-gl-js/v2.13.0/mapbox-gl.css" rel="stylesheet"> <script src="https://api.mapbox.com/mapbox-gl-js/v2.13.0/mapbox-gl.js"></script> <script src="https://yourwebsite.com/cpresources/[HASH]/js/mapbox.js"></script> <script src="https://yourwebsite.com/cpresources/[HASH]/js/dynamicmap.js"></script>
Not seeing these lines in your source code?
Make sure that the
For various reasons, you may not want these files to be loaded automatically. It's possible to suppress the initial automatic loading of these assets, then manually load them later.
# Loaded Automatically
# Disable Automatic Loading
If necessary, you can prevent the required assets from being loaded automatically. When the
tag method is appended, simply set the
assets value to
This will prevent the assets from being automatically injected into your HTML.
# Loaded Manually
If you are not automatically loading the required assets, you will instead be responsible for loading them manually. There are several ways to approach this, how you choose to go about it is up to you.
The simplest approach is to use to the
You'll need to specify which API service is being loaded (either
If you really don't want Twig/PHP to load the assets on your behalf, and are determined to take matters into your own hands, there is one other tool available to you.
getAssets method will retrieve the list of required JS assets as an array of required URLs. Once you have those URLs, you are free to load them into the page as you see fit.