Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-htmlhint-inline

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-htmlhint-inline

Gulp plugin for linting inline html

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

gulp-htmlhint-inline

NPM

Usage

First, install gulp-htmlhint-inline as a development dependency:

npm install --save-dev gulp-htmlhint-inline

Then, add it to your gulpfile.js:

var gulp = require('gulp'),
    htmlhint_inline = require('gulp-htmlhint-inline');

gulp.task('htmlhint', function () {
  var options = {
        htmlhintrc: './.htmlhintrc',
        ignores: {
          '<?php': '?>'
        },
        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.

{
  "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
var gulp = require('gulp'),
    htmlhint_inline = require('gulp-htmlhint-inline');

gulp.task('htmlhint', function () {
  var options = {
        htmlhintrc: './.htmlhintrc',
        ignores: {
          '<?php': '?>'
        }
    };

  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.

var gulp = require('gulp'),
    htmlhint_inline = require('gulp-htmlhint-inline');

gulp.task('htmlhint', function () {
  var options = {
        htmlhintrc: './.htmlhintrc',
        ignores: {
          '<?php': '?>'
        }
    };

  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.


var gulp = require('gulp'),
    htmlhint_inline = require('gulp-htmlhint-inline');

gulp.task('htmlhint', function () {
  var options = {
        htmlhintrc: './.htmlhintrc',
        ignores: {
          '<?php': '?>'
        }
    };

    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

Keywords

FAQs

Package last updated on 08 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc