axa-ch / gulp-htmllint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gulp-htmllint NPM version Build Status Dependency Status

This module is an interface layer for htmllint.

Install

$ npm install gulp-htmllint --save-dev

Usage

var gulp = require('gulp'),
	htmllint = require('gulp-htmllint')
	gutil = require('gulp-util');

gulp.task('default', function() {
	return gulp.src('src/index.html')
		.pipe(htmllint({}, htmllintReporter));
});

function htmllintReporter(filepath, issues) {
	if (issues.length > 0) {
		issues.forEach(function (issue) {
			gutil.log(gutil.colors.cyan('[gulp-htmllint] ') + gutil.colors.white(filepath + ' [' + issue.line + ',' + issue.column + ']: ') + gutil.colors.red('(' + issue.code + ') ' + issue.msg));
		});

		process.exitCode = 1;
	}
}

Options

options.config

Type: String Default value: .htmllintrc

Config containing htmllint options.

options.plugins

Type: Array Default value: []

An array of strings, each of which should be the name of an htmllint plugin to require and use.

options.failOnError

Type: Boolean Default value: false

Boolean value to define if the process should exit with a code of 1 on htmllint errors.

Custom Reporter

The custom reporter is a function which accepts 2 parameters: filepath and an array of issues as returned by the htmlling-plugin.

About

License:MIT License


Languages

Language:JavaScript 100.0%