修订-十 / cms-amp
修订-十/cms的AMP模板和函数
dev-master
2020-02-11 14:12 UTC
Requires
- revision-ten/cms: ^2.0.0
This package is auto-updated.
Last update: 2024-09-12 00:14:11 UTC
README
安装
通过Composer安装
首选的安装方法是使用Packagist和Composer。运行以下命令以安装包并将它添加到项目的composer.json
作为需求项
composer req revision-ten/cms-amp
将新包添加到内核
在config/bundles.php中将包添加到CmsBundle之前。
RevisionTen\CMS_AMP\CmsAmpBundle::class => ['all' => true], RevisionTen\CMS\CmsBundle::class => ['all' => true],
添加路由
将路由添加到/config/routes.yaml
cmsampbundle: resource: "@CmsAmpBundle/Resources/config/routes.yaml" prefix: /
AMP绑定括号
不要使用括号语法。改用数据属性语法。
Wrong: <button [class]="myState"></button> Correct: <button data-amp-bind-class="myState"></button>
在服务器上转换AMP
npm install @ampproject/toolbox-cli --save -g
npx amp optimize input.html > output.html