Not sure if this came up already (at least I couldn't find anything): it looks like amp-script currently only supports embedding external JS via the src attribute. It'd be great to be able to define custom scripts inline:
<amp-script layout=container src="/examples/amp-script/hello-world.js">
<button id="greeting">Say hello</button>
<script>
const button = document.getElementById('greeting')
...
</script>
</amp-script>
I see a few advantages for this:
- This would greatly simplify documenting amp-script as samples would no longer need two files.
- Faster loading time (we probably should restrict script size for these cases even further).
Not sure if this came up already (at least I couldn't find anything): it looks like amp-script currently only supports embedding external JS via the
srcattribute. It'd be great to be able to define custom scripts inline:I see a few advantages for this: