npm

Need private packages and team management tools?Check out npm Orgs. »

amphtml-validator-rules

3.0.0 • Public • Published

amphtml-validator-rules

Get all the rules that the amphtml-validator uses.

Purpose

Easy way to inspect the definition of certain AMPHTML components. Makes it convenient for other libraries that are built on top of AMPHTML, like react-amphtml.

Example

const { tags } = require('amphtml-validator-rules');
 
console.log((
  tags.filter(({ tagName }) => tagName.toLowerCase() === 'template')
));

Prints the following:

[
  {
    htmlFormat: [],
    tagName: 'TEMPLATE',
    specName: null,
    extensionSpec: null,
    requiresExtension: ['amp-mustache'],
    mandatory: false,
    mandatoryAlternatives: null,
    unique: false,
    uniqueWarning: false,
    mandatoryParent: null,
    mandatoryAncestor: null,
    mandatoryAncestorSuggestedAlternative: null,
    disallowedAncestor: ['TEMPLATE'],
    descendantTagList: null,
    alsoRequiresTagWarning: [],
    satisfies: [],
    requires: [],
    deprecation: null,
    deprecationUrl: null,
    attrs: [167],
    attrLists: [],
    cdata: null,
    childTags: null,
    siblingsDisallowed: false,
    mandatoryLastChild: false,
    referencePoints: [],
    specUrl: null,
    ampLayout: null,
  },
]

Development

To build amphtml-validator-rules Docker is needed because the validation rules require Python and Protobuf to compile. Once, those are installed, build by running npm run prepublishOnly.

install

npm i amphtml-validator-rules

Downloadsweekly downloads

10

version

3.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability