@linthtml/gulp-linthtml
Version:
A gulp plugin for processing files with LintHTML
80 lines (52 loc) • 1.78 kB
Markdown
> A [gulp](https://gulpjs.com/) plugin for [LintHTML](https://github.com/linthtml/linthtml)
[](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).
```
npm install @linthtml/gulp-linthtml
```
```javascript
const {src} = require('gulp');
const linthtml = require('@linthtml/gulp-linthtml');
function lintHTML() {
return src("app/**/*.html")
.pipe(linthtml())
.pipe(linthtml.format())
.pipe(linthtml.failOnError());
}
lintHTML.description = "Analyse all HTML files using linthtml";
exports.default = lintHTML;
```
*No explicit configuration.* A `.linthtmlrc.*` file may be resolved relative to the gulpfile.
Type: `Object`
Set of [rules](https://github.com/linthtml/linthtml/blob/develop/docs/rules.md).
```javascript
{
"rules":{
"attr-bans": ["div", "center"],
"attr-quote-style": "double",
"html-req-lang": true
}
}
```
Type: `String`
Path to the LintHTML rules configuration file.
Type: `String`
Shorthand for defining `options.configFile`.
Stop a task/stream if a LintHTML error has been reported for any file.
```javascript
// Cause the stream to stop(/fail) before copying an invalid JS file to the output directory
gulp.src('**/*.html')
.pipe(linthtml())
.pipe(linthtml.failOnError());
```
Format all linted files once. This should be used in the stream after piping through `linthtml`; otherwise, this will find no LintHTML results to format.