Huh. Today I learned (from Alex MacArthur): you can access the current <script> element from a script (if it’s not type="module") with document.currentScript. Meaning you can put configuration data as attributes on it and pluck them off and use them. Like:
<h1 id="setMePlease"></h1>
<script data-some-value="foo">
const scriptData = document.currentScript.dataset;
setMePlease.textContent = scriptData.someValue;
</script>Code language: HTML, XML (xml) 