htmllint loader for webpack 1, 2 and 3
Install
$ npm install htmllint-loaderor$ yarn add htmllint-loader
Example
Example handlebars/php code:
Example error:
ignore code
You can go ahead and ignore single and multiple lines of code. You can write the disable statement inside of html, handlebars, or ejs comments.
Main Title {{!htmllint:disable-line}}Multi-Column <!-- htmllint:disable-line --><%# htmllint:disable %> 2 Column 3 Column 4 Column 5 Column 6 Column<%# htmllint:enable %>
Webpack 1.x Usage
Within your webpack configuration, you'll need to add the htmllint-loader to the list of module preloaders:
moduleexports = // ... module: loaders: test: /\(htm|html|xhtml|hbs|handlebars|php|ejs)$/ loader: "htmllint-loader" include: '_src/markup/' // ...
Optional query options:
moduleexports = // ... module: loaders: test: /\(htm|html|xhtml|hbs|handlebars|php|ejs)$/ loader: "htmllint-loader" include: '_src/markup/' query: config: '.htmllintrc' failOnError: true failOnWarning: false // ...
Webpack 2.x & 3.x Usage
Within your webpack configuration, you'll need to add the htmllint-loader to the list of module rules:
moduleexports = // ... module: rules: test: /$/ loader: 'htmllint-loader' exclude: // // ...
Optional query options:
moduleexports = // ... module: rules: test: /$/ loader: 'htmllint-loader' exclude: // query: config: '.htmllintrc' // path to custom config file failOnError: false failOnWarning: false // ...
.htmllintrc
.htmllintrc
should live in your project root. This file should be a valid JSON file that contains options defined
on the htmllint wiki.
Default htmllint-loader rules: