Skip to content
Newer
Older
100644 100 lines (69 sloc) 2.8 KB
499a18e @XhmikosR README: Switch to shields.io for the badges, add david-dm dependencies
XhmikosR authored
1 # grunt-html
2
f16d281 @XhmikosR Add AppVeyor support for Windows testing.
XhmikosR authored
3 [![Linux Build Status](https://img.shields.io/travis/jzaefferer/grunt-html/master.svg?label=Linux%20build)](https://travis-ci.org/jzaefferer/grunt-html)
4 [![Windows Build status](https://img.shields.io/appveyor/ci/jzaefferer/grunt-html/master.svg?label=Windows%20build)](https://ci.appveyor.com/project/jzaefferer/grunt-html/branch/master)
499a18e @XhmikosR README: Switch to shields.io for the badges, add david-dm dependencies
XhmikosR authored
5 [![Code Climate](https://img.shields.io/codeclimate/github/jzaefferer/grunt-html.svg)](https://codeclimate.com/github/jzaefferer/grunt-html)
6 [![Dependency Status](https://img.shields.io/david/jzaefferer/grunt-html.svg)](https://david-dm.org/jzaefferer/grunt-html)
7 [![devDependency Status](https://img.shields.io/david/dev/jzaefferer/grunt-html.svg)](https://david-dm.org/jzaefferer/grunt-html#info=devDependencies)
7eb5537 @jzaefferer Init
authored
8
7dda692 @sideshowbarker README: "Mike Smith's vnu.jar" -> "vnu.jar markup checker"
sideshowbarker authored
9 [Grunt][grunt] plugin for html validation, using the [vnu.jar markup checker][vnujar].
7eb5537 @jzaefferer Init
authored
10
11 ## Getting Started
fb709cb @jzaefferer Readme updates
authored
12 Install this grunt plugin next to your project's [Gruntfile.js][getting_started] with:
4847dc3 @thewarpaint Fix README minor style issue
thewarpaint authored
13
14 ```bash
15 npm install grunt-html --save-dev
16 ```
7eb5537 @jzaefferer Init
authored
17
1ba76b3 @jzaefferer Update readme for grunt 0.4
authored
18 Then add this line to your project's `Gruntfile.js`:
7eb5537 @jzaefferer Init
authored
19
eaeb144 @jzaefferer All: Add ignore option, to ignore certain errors.
authored
20 ```js
7eb5537 @jzaefferer Init
authored
21 grunt.loadNpmTasks('grunt-html');
22 ```
23
24 Then specify what files to validate in your config:
25
eaeb144 @jzaefferer All: Add ignore option, to ignore certain errors.
authored
26 ```js
7eb5537 @jzaefferer Init
authored
27 grunt.initConfig({
53034f3 @XhmikosR Tabs to spaces.
XhmikosR authored
28 htmllint: {
29 all: ["demos/**/*.html", "tests/**/*.html"]
30 }
7eb5537 @jzaefferer Init
authored
31 });
32 ```
33
34 For fast validation, keep that in a single group, as the validator initialization takes a few seconds.
35
eaeb144 @jzaefferer All: Add ignore option, to ignore certain errors.
authored
36 ## Options
37
6c62078 @jawshooah Tasks: Add `force` option to continue with warnings
jawshooah authored
38 ### `ignore`
39
40 Type: `Array`, `String`, or `RegExp`
41 Default: `null`
42
43 Use this to specify the error message(s) to ignore. For example:
eaeb144 @jzaefferer All: Add ignore option, to ignore certain errors.
authored
44
45 ```js
a054260 @jzaefferer README: Change examples to clearly separate targets from options
authored
46 all: {
53034f3 @XhmikosR Tabs to spaces.
XhmikosR authored
47 options: {
48 ignore: 'The “clear” attribute on the “br” element is obsolete. Use CSS instead.'
49 },
50 src: "html4.html"
eaeb144 @jzaefferer All: Add ignore option, to ignore certain errors.
authored
51 }
52 ```
53
6c62078 @jawshooah Tasks: Add `force` option to continue with warnings
jawshooah authored
54 The ignore option also supports regular expressions. For example, to ignore AngularJS directive attributes:
9141bc1 @strille Extend ignore option to support regex along with strings
strille authored
55
56 ```js
a054260 @jzaefferer README: Change examples to clearly separate targets from options
authored
57 all: {
53034f3 @XhmikosR Tabs to spaces.
XhmikosR authored
58 options: {
59 ignore: /attribute “ng-[a-z-]+” not allowed/
60 },
61 src: "app.html"
9141bc1 @strille Extend ignore option to support regex along with strings
strille authored
62 }
63 ```
64
6c62078 @jawshooah Tasks: Add `force` option to continue with warnings
jawshooah authored
65 ### `force`
66
67 Type: `Boolean`
68 Default: `false`
69
70 Set `force` to `true` to report errors but not fail the `grunt` task.
71
fa6d365 @jawshooah Add checkstyle and json reporters
jawshooah authored
72 ### `reporter`
73
74 Type: `String`
75 Default: `null`
76
77 Allows 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` or `json`.
78
79 ### `reporterOutput`
80
81 Type: `String`
82 Default: `null`
83
84 Specify 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`.
85
86 ### `absoluteFilePathsForReporter`
87
88 Type: `Boolean`
89 Default: `false`
90
91 Set `absoluteFilePathsForReporter` to `true` to use absolute file paths in generated reports.
92
eaeb144 @jzaefferer All: Add ignore option, to ignore certain errors.
authored
93 [grunt]: http://gruntjs.com/
94 [getting_started]: http://gruntjs.com/getting-started
66054bb @XhmikosR README: Add build status badge
XhmikosR authored
95 [vnujar]: https://validator.github.io/validator/
7eb5537 @jzaefferer Init
authored
96
97 ## License
66054bb @XhmikosR README: Add build status badge
XhmikosR authored
98 Copyright Jörn Zaefferer.
7eb5537 @jzaefferer Init
authored
99 Licensed under the MIT license.
Something went wrong with that request. Please try again.