AMP:Building Accelerated Mobile Pages
上QQ阅读APP看书,第一时间看更新

Command line validation

If you have Node.js installed on your machine, you can use the command line validation tool to validate both local and remote files. An advantage of this tool is that it can be included in your workflow and deployment process to automatically validate pages, and alert you when unexpected validation failures occur. A process like this will help to ensure that you don't accidentally deploy invalid pages and lose AMP badges and positioning in AMP search results carousels.

You can install the command line validator with the following command:

npm install -g amphtml-validator

To validate a page, use:

amphtml-validator https://theampbook.com

If it validates you will see:

https://theampbook.com: PASS

If there are any validation failures, they are listed just like in the developer console tool:

AMP validation with command line tool