Skip to content

waldronmatt/html-validate-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-validate-webpack-plugin

An html-validate.org webpack plugin

About plugin

This plugin is a simple wrapper around the html-validate.org cli.

Validate your html automatically after each webpack compilation; similarly to how you would use eslint and stylelint.

Install

npm install html-validate-webpack-plugin --save-dev

Note: Install html-validate if you haven't already.

npm install html-validate --save-dev

Or globally:

npm install html-validate -g

Note: Make sure you have created a .htmlvalidate.json file with your configurations. See this page for instructions.

Usage

In your webpack configuration (development builds):

const HtmlValidatePlugin = require("html-validate-webpack-plugin");

module.exports = {
  // ...
  plugins: [new HtmlValidatePlugin()],
  // ...
};

Options

You can pass html-validate.org cli options.

path

  • Type: String
  • Default: src/**/*

Specifies the directories/files for html-validate to search.

Examples:

  • A single file: src/**/index

extensions

  • Type: array
  • Default: ['html']

Specifies the file extensions to use when searching for files in directories.

Examples:

  • Multiple extensions: ['html', 'ejs']

config

  • Type: String
  • Default: .htmlvalidate.json

Specify a different configuration file.

Examples:

  • Your custom configuration: 'myconfig' (omit the .json extension)

global

  • Type: boolean
  • Default: false

Specify the run context of html-validate. If you installed html-validate globally, set the value to true.

Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

An HTML-validate.org plugin for webpack

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project