Last change
on this file since 531 was
484,
checked in by hendrikvanantwerpen, 11 years ago
|
Commit node_modules, to make checkouts and builds more deterministic.
|
File size:
2.0 KB
|
Line | |
---|
1 | # grunt-htmlhint
|
---|
2 |
|
---|
3 | > Validate html files with htmlhint.
|
---|
4 |
|
---|
5 | ## Getting Started
|
---|
6 | This plugin requires Grunt `~0.4.1`
|
---|
7 |
|
---|
8 | If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
|
---|
9 |
|
---|
10 | ```shell
|
---|
11 | npm install grunt-htmlhint --save-dev
|
---|
12 | ```
|
---|
13 |
|
---|
14 | One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
|
---|
15 |
|
---|
16 | ```js
|
---|
17 | grunt.loadNpmTasks('grunt-htmlhint');
|
---|
18 | ```
|
---|
19 |
|
---|
20 | ## The "htmlhint" task
|
---|
21 |
|
---|
22 | ### Overview
|
---|
23 | In your project's Gruntfile, add a section named `htmlhint` to the data object passed into `grunt.initConfig()`.
|
---|
24 |
|
---|
25 | ### Options
|
---|
26 |
|
---|
27 | See all rules here: [https://github.com/yaniswang/HTMLHint/wiki/Rules](https://github.com/yaniswang/HTMLHint/wiki/Rules)
|
---|
28 |
|
---|
29 | If options is empty, task will scan nothing.
|
---|
30 |
|
---|
31 | #### options.htmlhintrc
|
---|
32 | Type: `String`
|
---|
33 | Default value: `null`
|
---|
34 |
|
---|
35 | If this filename is specified, options and globals defined therein will be used. Task and target options override the options within the `htmlhintrc` file. The `htmlhintrc` file must be valid JSON and looks something like this:
|
---|
36 |
|
---|
37 | ```json
|
---|
38 | {
|
---|
39 | "tag-pair": true,
|
---|
40 | }
|
---|
41 | ```
|
---|
42 |
|
---|
43 | #### options.force
|
---|
44 | Type: `Boolean`
|
---|
45 | Default value: `false`
|
---|
46 |
|
---|
47 | Report HTMLHint errors but dont fail the task
|
---|
48 |
|
---|
49 | ### Usage Examples
|
---|
50 |
|
---|
51 | #### Direct options
|
---|
52 |
|
---|
53 | ```js
|
---|
54 | htmlhint: {
|
---|
55 | html1: {
|
---|
56 | options: {
|
---|
57 | 'tag-pair': true
|
---|
58 | },
|
---|
59 | src: ['path/to/**/*.html']
|
---|
60 | },
|
---|
61 | html2: {
|
---|
62 | options: {
|
---|
63 | 'tag-pair': true
|
---|
64 | },
|
---|
65 | src: ['path/to/**/*.html']
|
---|
66 | }
|
---|
67 | }
|
---|
68 | ```
|
---|
69 |
|
---|
70 | #### Config file
|
---|
71 |
|
---|
72 | ```js
|
---|
73 | htmlhint: {
|
---|
74 | options: {
|
---|
75 | htmlhintrc: '.htmlhintrc'
|
---|
76 | },
|
---|
77 | html1: {
|
---|
78 | src: ['path/to/**/*.html']
|
---|
79 | },
|
---|
80 | html2: {
|
---|
81 | src: ['path/to/**/*.html']
|
---|
82 | }
|
---|
83 | }
|
---|
84 | ```
|
---|
85 |
|
---|
86 | ## Release History
|
---|
87 |
|
---|
88 | * 2013-4-6âââv0.4.0âââFirst release |
---|
Note: See
TracBrowser
for help on using the repository browser.