I have amp-html form what opens in lightbox, opened by click link, on every page. Is there a way to dynamically load amp scripts and a amp-html for form? This form rarely used and I want to speed up site load. There are other elements wants dynamic loading, what I do when find answer to this question.
In head of the script, this need dynamic loading:
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script>
In body of page:
<amp-lightbox
id=checkin-lightbox
layout="nodisplay"
class="popup-lightbox">
...
<form method="post"
action-xhr="checkin_xhr.php"
target="_top"
on="submit-success:checkin-lightbox.close,checkin-lightbox-message">
...