My workflow is to write es6, and use webpack to bundle and transpile down to es5 with babel.
In the case of wanting static maps on a page. I have a maps.js
file, which is a target of my webpack config.
This maps.js
file looks for all .map
divs and runs an addMap()
function on them. This is defined inside a mapbox-utils.js
file.
It starts with various helper functions, then there is the actual addMap()
function.
Hopefully you can work out what I’m doing.