ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

[Amp optimizer] Import `amp-animation-0.1.js` when story contains `animate-in` attribute or `amp-story-animation` #34545

Open mszylkowski opened 3 years ago

mszylkowski commented 3 years ago

Description

Stories run animate-in and amp-story-animation elements using amp-animation but the component is lazy loaded if not imported in the document head. We want the amp-optimizer to add the script tag importing it when we know it will be necessary.

<script async custom-element="amp-animation" src="https://cdn.ampproject.org/v0/amp-animation-0.1.js"></script>

Alternatives Considered

Lazy loading amp-animation is what currently happens, but on throttled connections and slow devices, the lazy-loaded extension will take some time to load, delaying the animate-in animations, the amp-story-animation animations, and finish animations on prefers-reduced-motion devices.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.