AMP希望样板文件保持小型化。我刚刚把你的样板代码粘贴到AMP Playground文档中,得到的错误与你得到的完全相同。
只是为了确认这是缩小版,我从你的岗位上缩小了你的样板,它成功了。
<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>
编辑:
我又玩了一会儿。您可以在开始和结束标记之前和之后添加返回。禁止向CSS本身添加任何返回或空格。
<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>
Here is a link
解释AMP样板代码并允许更改。基本上,您只能在标签之后立即添加空白,并且可以在已经存在的地方添加更多的空白。
AMP HTML文档的头标记中必须包含以下样板文件。验证目前是用正则表达式完成的,所以保持尽可能少的突变是很重要的。目前,允许的变异是:(1)在样式标记打开后立即插入任意空格,并在其关闭前立即插入;(2)用任意空格替换下面代码片段中的任何空格。