html5 loader,GitHub - robbiedigital/htmllint-loader: htmllint loader for webpack

htmllint loader for webpack 1, 2 and 3

$ npm install htmllint-loader

or

$ yarn add htmllint-loader

Example

Example handlebars/php code:

24ef09499e134b82b2d129710dedd959.png

Example error:

59cbda72a8b1e4eec25e8ae17980eee8.png

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

Webpack 1.x Usage

Within your webpack configuration, you'll need to add the htmllint-loader to the list of module preloaders:

module.exports = {

// ...

module: {

loaders: [

{

test: /\(htm|html|xhtml|hbs|handlebars|php|ejs)$/,

loader: "htmllint-loader",

include: '_src/markup/',

},

],

},

// ...

}

Optional query options:

module.exports = {

// ...

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:

module.exports = {

// ...

module: {

rules: [

{

test: /(htm|html|xhtml|hbs|handlebars|php|ejs)$/,

loader: 'htmllint-loader',

exclude: /(node_modules)/,

},

]

},

// ...

}

Optional query options:

module.exports = {

// ...

module: {

rules: [

{

test: /(htm|html|xhtml|hbs|handlebars|php|ejs)$/,

loader: 'htmllint-loader',

exclude: /(node_modules)/,

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:

{

"attr-bans": [

"align",

"background",

"bgcolor",

"border",

"dynsrc",

"frameborder",

"longdesc",

"lowsrc",

"onclick",

"ondblclick",

"onload",

"marginwidth",

"marginheight",

"scrolling",

"style",

"width",

"height"

],

"attr-name-ignore-regex": false,

"attr-name-style": "dash",

"attr-new-line": false,

"attr-no-dup": true,

"attr-no-unsafe-char": true,

"attr-order": false,

"attr-quote-style": "double",

"attr-req-value": false,

"attr-validate": false,

"class-no-dup": true,

"class-style": "bem",

"doctype-first": false,

"doctype-html5": false,

"fig-req-figcaption": true,

"focusable-tabindex-style": false,

"head-req-title": true,

"head-valid-content-model": true,

"href-style": false,

"html-req-lang": true,

"html-valid-content-model": false,

"id-class-ignore-regex": false,

"id-class-no-ad": true,

"id-class-style": "dash",

"id-no-dup": true,

"img-req-alt": "allownull",

"img-req-src": false,

"indent-style": "spaces",

"indent-width": 2,

"indent-width-cont": true,

"input-radio-req-name": true,

"input-req-label": false,

"label-req-for": false,

"lang-style": "case",

"line-end-style": false,

"line-max-len": false,

"line-max-len-ignore-regex": "/href/g",

"maxerr": false,

"raw-ignore-regex": false,

"spec-char-escape": false,

"table-req-caption": false,

"table-req-header": false,

"tag-bans": [

"b",

"keygen",

"style"

],

"tag-close": true,

"tag-name-lowercase": true,

"tag-name-match": true,

"tag-self-close": "always",

"text-ignore-regex": false,

"title-max-len": 80,

"title-no-dup": true

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值