https://github.com/htmlhint/gulp-htmlhint-inline
gulp plugin for linting inline html
https://github.com/htmlhint/gulp-htmlhint-inline
gulp-plugin htmlhint linter
Last synced: 3 months ago
JSON representation
gulp plugin for linting inline html
- Host: GitHub
- URL: https://github.com/htmlhint/gulp-htmlhint-inline
- Owner: htmlhint
- License: mit
- Created: 2015-03-13T16:40:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2026-03-06T08:46:42.000Z (4 months ago)
- Last Synced: 2026-03-06T12:44:21.512Z (4 months ago)
- Topics: gulp-plugin, htmlhint, linter
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/gulp-htmlhint-inline
- Size: 159 KB
- Stars: 3
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
gulp-htmlhint-inline
================
[](https://nodei.co/npm/gulp-htmlhint-inline/)
## Usage
First, install `gulp-htmlhint-inline` as a development dependency:
```shell
npm install --save-dev gulp-htmlhint-inline
```
Then, add it to your `gulpfile.js`:
```javascript
var gulp = require('gulp'),
htmlhint_inline = require('gulp-htmlhint-inline');
gulp.task('htmlhint', function () {
var options = {
htmlhintrc: './.htmlhintrc',
ignores: {
''
},
patterns: [
{
match: /hoge/g,
replacement: 'fuga'
}
]
};
gulp.src('test/*.phtml')
.pipe(htmlhint_inline(options))
.pipe(htmlhint_inline.reporter())
.pipe(htmlhint_inline.reporter('fail'));
});
```
## Options
#### htmlhintrc
Type: String Default value: null
```htmlhintrc``` file must be a valid JSON.
If you specify this file, options that have been defined in it will be used in the global.
If there is specified in the task options, the options in this file will be overwritten.
```json
{
"tagname-lowercase": true
}
```
#### ignores
Type: Object Default: {}
Remove program tag pairs.
#### patterns
Type: Array Default: []
Enable the replacement by the pattern
##### patterns.match
Type: RegExp|String
Indicates the matching expression.
##### patterns.replacement
Type: String | Function
#### reporter
##### Default Reporter
```js
var gulp = require('gulp'),
htmlhint_inline = require('gulp-htmlhint-inline');
gulp.task('htmlhint', function () {
var options = {
htmlhintrc: './.htmlhintrc',
ignores: {
''
}
};
gulp.src('test/*.phtml')
.pipe(htmlhint_inline(options))
.pipe(htmlhint_inline.reporter());
});
```
##### Fail Reporter
In order to end the task when your task happened error of HTMLHint, please use this reporter.
```js
var gulp = require('gulp'),
htmlhint_inline = require('gulp-htmlhint-inline');
gulp.task('htmlhint', function () {
var options = {
htmlhintrc: './.htmlhintrc',
ignores: {
''
}
};
gulp.src('test/*.phtml')
.pipe(htmlhint_inline(options))
.pipe(htmlhint_inline.reporter('fail'));
});
```
##### Custom Reporter
You can also use the custom reporter that you have created.
```js
var gulp = require('gulp'),
htmlhint_inline = require('gulp-htmlhint-inline');
gulp.task('htmlhint', function () {
var options = {
htmlhintrc: './.htmlhintrc',
ignores: {
''
}
};
var cutomReporter = function (file) {
if (!file.htmlhint_inline.success) {
console.log('custom reporter: htmlhint-inline fail in '+ file.path);
}
}
return gulp.src('test/*.phtml')
.pipe(htmlhint_inline(options))
.pipe(htmlhint_inline.reporter())
.pipe(htmlhint_inline.reporter(cutomReporter));
});
```
## License
[MIT License](http://en.wikipedia.org/wiki/MIT_License)
[npm-url]: https://npmjs.org/package/gulp-htmlhint-inline
[npm-image]: https://badge.fury.io/js/gulp-htmlhint-inline.png