Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

gulp-amphtml-validator

1.0.2 • Public • Published

Gulp AMPHTML Validator

A Gulp plugin for validating AMPHTML files using the official AMPHTML Validator.

Installation

Install package with NPM and add it to your development dependencies:

npm install --save-dev gulp-amphtml-validator

Usage

const gulpAmpValidator = require('gulp-amphtml-validator');
 
gulp.task('amphtml:validate', () => {
  return gulp.src('*.html')
    // Validate the input and attach the validation result to the "amp" property
    // of the file object. 
    .pipe(gulpAmpValidator.validate())
    // Print the validation results to the console.
    .pipe(gulpAmpValidator.format())
    // Exit the process with error code (1) if an AMP validation error
    // occurred.
    .pipe(gulpAmpValidator.failAfterError());
});

To treat warnings as errors, replace the last line of the validation closure with:

// Exit the process with error code (1) if an AMP validation warning or
// error occurred.
.pipe(gulpAmpValidator.failAfterWarningOrError());
 

Release Notes

1.0.2

  • Add failAfterWarningOrError option
  • Upgrade amphtml-validator version to 1.0.21

1.0.1

  • Upgrade amphtml-validator version to 1.0.18

1.0.0

  • initial release

install

npm i gulp-amphtml-validator

Downloadsweekly downloads

167

version

1.0.2

license

Apache-2.0

repository

Gitgithub

last publish

collaborators

  • avatar