{"id":13852043,"url":"https://github.com/validator/grunt-html","last_synced_at":"2025-05-14T18:02:54.555Z","repository":{"id":35096735,"uuid":"4103167","full_name":"validator/grunt-html","owner":"validator","description":"Grunt plugin for HTML validation, using the official Nu Html Checker (v.Nu)","archived":false,"fork":false,"pushed_at":"2024-10-22T04:40:29.000Z","size":73844,"stargazers_count":183,"open_issues_count":2,"forks_count":41,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-13T10:04:49.263Z","etag":null,"topics":["checker","css","grunt","gruntplugin","html","htmllint","javascript","lint","validator","vnu","vnu-jar"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/validator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-04-22T10:19:49.000Z","updated_at":"2025-04-09T13:41:51.000Z","dependencies_parsed_at":"2024-03-03T07:31:30.400Z","dependency_job_id":"3e720711-5aad-484b-9d57-507a272b4a0e","html_url":"https://github.com/validator/grunt-html","commit_stats":{"total_commits":410,"total_committers":20,"mean_commits":20.5,"dds":"0.25365853658536586","last_synced_commit":"5738b2ff16c05c14b1b75c15679a27e4e27222ca"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/validator%2Fgrunt-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/validator%2Fgrunt-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/validator%2Fgrunt-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/validator%2Fgrunt-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/validator","download_url":"https://codeload.github.com/validator/grunt-html/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198452,"owners_count":22030964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["checker","css","grunt","gruntplugin","html","htmllint","javascript","lint","validator","vnu","vnu-jar"],"created_at":"2024-08-04T22:00:55.183Z","updated_at":"2025-05-14T18:02:49.528Z","avatar_url":"https://github.com/validator.png","language":"JavaScript","readme":"# grunt-html\n\n[![npm version](https://img.shields.io/npm/v/grunt-html?logo=npm\u0026logoColor=fff)](https://www.npmjs.com/package/grunt-html)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/validator/grunt-html/test.yml?branch=main\u0026label=Tests\u0026logo=github)](https://github.com/validator/grunt-html/actions/workflows/test.yml?query=branch%3Amain)\n[![Coverage Status](https://img.shields.io/coveralls/github/validator/grunt-html/main?logo=coveralls\u0026logoColor=fff)](https://coveralls.io/github/validator/grunt-html?branch=main)\n\n[Grunt][grunt] plugin for HTML validation, using the [Nu Html Checker (v.Nu)][vnujar].\n\n## Getting Started\n\nInstall this grunt plugin next to your project's [Gruntfile.js][getting_started] with:\n\n```bash\nnpm install grunt-html -D\n```\n\nThen add this line to your project's `Gruntfile.js`:\n\n```js\ngrunt.loadNpmTasks('grunt-html');\n```\n\nThen specify what files to validate in your config:\n\n```js\ngrunt.initConfig({\n  htmllint: {\n    all: ['demos/**/*.html', 'tests/**/*.html']\n  }\n});\n```\n\nFor fast validation, keep that in a single group, as the validator initialization takes a few seconds.\n\nWhen combined with a watching task (such as [grunt-contrib-watch][watch]), even faster validation can be achieved by starting the validator in client mode and connecting to an already-running instance of the validator in server mode. This removes the time required by repeated initializations. See the `server` option below.\n\n## Options\n\n### `errorlevels`\n\n* Type: `Array`\n* Default: `['info', 'warning', 'error']`\n\nSet `errorlevels` to control which error types are returned from the validator. Ignores all other returned types.\n\n### `force`\n\n* Type: `Boolean`\n* Default: `false`\n\nSet `force` to `true` to report errors but not fail the `grunt` task.\n\n### `ignore`\n\n* Type: `Array`, `String`, or `RegExp`\n* Default: `null`\n\nUse this to specify the error message(s) to ignore. For example:\n\n```js\nall: {\n  options: {\n    ignore: 'The “clear” attribute on the “br” element is obsolete. Use CSS instead.'\n  },\n  src: 'html4.html'\n}\n```\n\nThe `ignore` option also supports regular expressions. For example, to ignore AngularJS directive attributes:\n\n```js\nall: {\n  options: {\n    ignore: /attribute “ng-[a-z-]+” not allowed/\n  },\n  src: 'app.html'\n}\n```\n\n### `noLangDetect`\n\n* Type: `Boolean`\n* Default: `false`\n\nSet `noLangDetect` to `true` to [skip the checking of the language of the page](https://github.com/validator/validator#--no-langdetect).\n\n### `reporter`\n\n* Type: `String`\n* Default: `null`\n\nAllows you to modify the output format. By default, this plugin will use a built-in Grunt reporter. Set the path to your own custom reporter or to one of the provided reporters: `checkstyle`, `junit` or `json`.\n\n### `reporterOutput`\n\n* Type: `String`\n* Default: `null`\n\nSpecify a filepath to output the results of a reporter. If `reporterOutput` is specified then all output will be written to the given filepath rather than printed to `stdout`.\n\n### `absoluteFilePathsForReporter`\n\n* Type: `Boolean`\n* Default: `false`\n\nSet `absoluteFilePathsForReporter` to `true` to use absolute file paths in generated reports.\n\n### `server`\n\n* Type: `Object`, or a falsy value\n* Default: `false`\n\nWhen `server` is set to a falsy value, the validator is invoked using `java -jar`, which can be considered normal operation.\n\nSet `server` to an object to start the validator in client mode and connect to an already-running instance of the validator in server mode.\n\nTo start the validator in server mode, use `java -cp \"path/to/vnu.jar\" nu.validator.servlet.Main \u003cport\u003e`.\n\n```js\nall: {\n  options: {\n    // connect to a validator instance running in server mode on localhost:8888\n    server: {}\n  },\n  src: 'app.html'\n}\n```\n\nThe `server` object also accepts the `host` and `port` keys, specifying the location of the server.\n\n```js\nall: {\n  options: {\n    server: {\n      // your team's local dev tool machine, for example\n      host: '192.168.0.5',\n      port: 8877\n    }\n  },\n  src: 'app.html'\n}\n```\n\nThe following configuration in Gruntfile.js uses [grunt-vnuserver][vnuserver] to start the validator in server mode and sets up a watch task to run `htmllint` every time the source file changes.\nBy 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.\n\n```js\nmodule.exports = function (grunt) {\n  grunt.initConfig({\n    vnuserver: {\n    },\n    htmllint: {\n      all: {\n        options: {\n          server: {}\n        },\n        src: 'app.html'\n      }\n    },\n    watch: {\n      all: {\n        tasks: ['htmllint'],\n        files: 'app.html'\n      }\n    }\n  });\n\n  grunt.loadNpmTasks('grunt-vnuserver');\n  grunt.loadNpmTasks('grunt-html');\n  grunt.loadNpmTasks('grunt-contrib-watch');\n\n  grunt.registerTask('default', ['vnuserver', 'watch']);\n};\n```\n\n### `threads`\n\n* Type: `String`, `Boolean`, `Number`\n* Default: `auto`, which is the number of threads -1\n\nUse this option to control the number of threads that grunt-html will use when validating a big number of files. This will spawn as many Java processes as the number of threads.\n\n## Potential pitfalls\n\n* vnu.jar requires Java 8 environment or up.\n\n## License\n\nCopyright Jörn Zaefferer. Licensed under the [MIT license](LICENSE).\n\n[grunt]: https://gruntjs.com/\n[getting_started]: https://gruntjs.com/getting-started\n[vnujar]: https://validator.github.io/validator/\n[watch]: https://github.com/gruntjs/grunt-contrib-watch\n[vnuserver]: https://www.npmjs.com/package/grunt-vnuserver\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalidator%2Fgrunt-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalidator%2Fgrunt-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalidator%2Fgrunt-html/lists"}