Skip to content

A grunt task to start the v.Nu html validator in server mode for faster validations.

License

Notifications You must be signed in to change notification settings

bennieswart/grunt-vnuserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grunt-vnuserver

Code Climate Dependency Status devDependency Status

Grunt plugin for starting the vnu.jar markup checker in server mode. Plays well with grunt-html for faster HTML validation by only starting vnu.jar once, as startup can take a few seconds.

Getting Started

Install this grunt plugin next to your project's Gruntfile.js with:

npm install grunt-vnuserver --save-dev

Then add this line to your project's Gruntfile.js:

grunt.loadNpmTasks('grunt-vnuserver');

Options

port

  • Type: Number
  • Default: 8888

The port on which to start the server.

all: {
  options: {
      port: 8877
  },
}

skippable

  • Type: Boolean
  • Default: false

Whether or not to skip server startup if port is already in use. Task will fail if port is in use and skippable is false.

persist

  • Type: Boolean
  • Default: false

Whether or not to keep the vnu server running even after grunt exists. If false, vnu server is killed when grunt exists.

Example

Consider the following configuration in Gruntfile.js in which the watch task is set to run htmllint every time the source file changes. By starting the validator in server mode once using the vnuserver task, validations by htmllint can be performed much faster by simply connecting to this already-running server.

module.exports = function (grunt) {
    grunt.initConfig({
        vnuserver: {
        },
        htmllint: {
            all: {
                options: {
                    // This option makes grunt-html connect to the vnu server instance.
                    server: {}
                },
                src: "app.html"
            }
        },
        watch: {
            all: {
                tasks: ['htmllint'],
                files: "app.html"
            }
        },
    });

    grunt.loadNpmTasks('grunt-vnuserver');
    grunt.loadNpmTasks('grunt-html');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.registerTask('default', ['vnuserver', 'watch']);
};

License

Copyright Bennie Swart. Licensed under the MIT license.

About

A grunt task to start the v.Nu html validator in server mode for faster validations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published