修订-十/cms-amp

修订-十/cms的AMP模板和函数

安装: 65

依赖项: 0

建议者: 0

安全: 0

星级: 0

关注者: 1

分支: 0

开放问题: 0

语言:JavaScript

类型:symfony-bundle

dev-master 2020-02-11 14:12 UTC

This package is auto-updated.

Last update: 2024-09-12 00:14:11 UTC


README

Latest Version Software License Total Downloads

安装

通过Composer安装

首选的安装方法是使用PackagistComposer。运行以下命令以安装包并将它添加到项目的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