revision-ten/cms-amp

AMP templates and functions for revision-ten/cms

Installs: 65

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:symfony-bundle

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

This package is auto-updated.

Last update: 2024-11-12 00:33:11 UTC


README

Latest Version Software License Total Downloads

Installation

Install via composer

The preferred method of installation is via Packagist and Composer. Run the following command to install the package and add it as a requirement to your project's composer.json:

composer req revision-ten/cms-amp

Add the new bundles to the kernel

Add the bundle to your config/bundles.php before the CmsBundle.

RevisionTen\CMS_AMP\CmsAmpBundle::class => ['all' => true],
RevisionTen\CMS\CmsBundle::class => ['all' => true],

Add routes

Add the routes to your /config/routes.yaml:

cmsampbundle:
    resource: "@CmsAmpBundle/Resources/config/routes.yaml"
    prefix:   /

AMP bind brackets

Do not use the brackets syntax. Use data attributes syntax instead.

Wrong:
<button [class]="myState"></button>

Correct:
<button data-amp-bind-class="myState"></button>

Transform AMP on the server

npm install @ampproject/toolbox-cli --save -g
npx amp optimize input.html > output.html