项目作者: test-room-7

项目描述 :
Validate files with html-validate
高级语言: JavaScript
项目地址: git://github.com/test-room-7/gulp-html-validate.git
创建时间: 2020-08-13T19:22:16Z
项目社区:https://github.com/test-room-7/gulp-html-validate

开源协议:MIT License

下载


gulp-html-validate

Validate files with html-validate validator.

Installation

  1. > npm install --save-dev gulp-html-validate

Usage

  1. const gulp = require('gulp');
  2. const htmlvalidate = require('gulp-html-validate');
  3. exports.default = () => {
  4. return (
  5. gulp
  6. .src('index.html')
  7. /*
  8. * Apply the `html-validate` report to each file object, so these
  9. * reports can be used by other modules.
  10. */
  11. .pipe(htmlvalidate())
  12. /*
  13. * Output `html-validate` results to the console.
  14. */
  15. .pipe(htmlvalidate.format())
  16. /*
  17. * Make gulp to exit with an error code if any error(s) occurred.
  18. */
  19. .pipe(htmlvalidate.failAfterError())
  20. );
  21. };

API

htmlvalidate()

Apply html-validate report to each file.

format(formatter)

Print a report where all errors/warnings are listed. This function should be used in the stream after piping through htmlvalidate function; otherwise, it will find no html-validate results to format.

The formatter parameter is a string, which defined the formatter name to use.

Any formatter supported by html-validate can be used. The stylish formatter is used by default.

failAfterError()

Throw an error if html-validate found an error in any file. All files will be processed before throwing an error.

License

Licensed under the MIT License.