From 0c2d865cb2897c72f67cb8302e0a284ff26a0f42 Mon Sep 17 00:00:00 2001 From: Sanjaiyan Parthipan <parthipankalayini@gmail.com> Date: Sat, 8 Oct 2022 12:10:40 +0530 Subject: [PATCH 1/2] sanjaiyan: hoist script preload amp --- packages/amp/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amp/index.js b/packages/amp/index.js index 5b54cb8919db..05133a3f4418 100644 --- a/packages/amp/index.js +++ b/packages/amp/index.js @@ -1,7 +1,7 @@ // https://amp.dev/documentation/guides-and-tutorials/learn/spec/amp-boilerplate/ const boilerplate = ` + <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js" /> <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> - <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js"> <script async src="https://cdn.ampproject.org/v0.js"></script> `; From d96d8bf36c0468badaa04db3d67a63829a9ff101 Mon Sep 17 00:00:00 2001 From: Rich Harris <hello@rich-harris.dev> Date: Mon, 10 Oct 2022 11:00:44 -0400 Subject: [PATCH 2/2] match current boilerplate recommendations --- .changeset/rude-berries-rush.md | 5 +++++ packages/amp/index.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/rude-berries-rush.md diff --git a/.changeset/rude-berries-rush.md b/.changeset/rude-berries-rush.md new file mode 100644 index 000000000000..c0ef804874cf --- /dev/null +++ b/.changeset/rude-berries-rush.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/amp': patch +--- + +Amend boilerplate to match current recommendations diff --git a/packages/amp/index.js b/packages/amp/index.js index 05133a3f4418..41fb0c55afe6 100644 --- a/packages/amp/index.js +++ b/packages/amp/index.js @@ -1,8 +1,8 @@ // https://amp.dev/documentation/guides-and-tutorials/learn/spec/amp-boilerplate/ const boilerplate = ` - <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js" /> - <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> + <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js" /> <script async src="https://cdn.ampproject.org/v0.js"></script> + <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> `; /** @param {string} html */