From 0cf5204a48157b41420e60d8a71ac0ddbb968ab5 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Thu, 14 Jul 2016 16:22:56 -0700 Subject: [PATCH] Add HTMLHint to the build; fixes #20297 (#20301) [skip sauce] --- Gruntfile.js | 5 ++++- docs/.htmlhintrc | 15 +++++++++++++++ package.json | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 docs/.htmlhintrc diff --git a/Gruntfile.js b/Gruntfile.js index 74e9697a42..0deece20ce 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -278,6 +278,9 @@ module.exports = function (grunt) { 'postcss-docs': { command: 'npm run postcss-docs' }, + htmlhint: { + command: 'npm run htmlhint' + }, 'upload-preview': { command: './grunt/upload-preview.sh' } @@ -327,7 +330,7 @@ module.exports = function (grunt) { require('time-grunt')(grunt); // Docs HTML validation task - grunt.registerTask('validate-html', ['jekyll:docs', 'htmllint']); + grunt.registerTask('validate-html', ['jekyll:docs', 'htmllint', 'exec:htmlhint']); var runSubset = function (subset) { return !process.env.TWBS_TEST || process.env.TWBS_TEST === subset; diff --git a/docs/.htmlhintrc b/docs/.htmlhintrc new file mode 100644 index 0000000000..636af68d76 --- /dev/null +++ b/docs/.htmlhintrc @@ -0,0 +1,15 @@ +{ + "attr-lowercase": true, + "attr-no-duplication": true, + "alt-require": true, + "attr-unsafe-chars": true, + "attr-value-double-quotes": true, + "doctype-first": true, + "doctype-html5": true, + "id-unique": true, + "spec-char-escape": true, + "src-not-empty": true, + "tag-pair": true, + "tagname-lowercase": true, + "title-require": true +} diff --git a/package.json b/package.json index 4fe64fd595..2d6b598d2d 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "change-version": "node grunt/change-version.js", "eslint": "eslint --config js/.eslintrc.json js/src", "jscs": "jscs --config=js/.jscsrc js/src js/tests/unit docs/assets/js/src grunt Gruntfile.js docs/assets/js/ie-emulation-modes-warning.js docs/assets/js/ie10-viewport-bug-workaround.js", + "htmlhint": "htmlhint --config docs/.htmlhintrc _gh_pages/", "postcss": "postcss --config grunt/postcss.js --replace dist/css/*.css", "postcss-docs": "postcss --config grunt/postcss.js --no-map --replace docs/assets/css/docs.min.css && postcss --config grunt/postcss.js --no-map --replace docs/examples/**/*.css", "shrinkwrap": "npm shrinkwrap --dev && shx mv ./npm-shrinkwrap.json ./grunt/npm-shrinkwrap.json", @@ -64,6 +65,7 @@ "grunt-saucelabs": "^9.0.0", "grunt-scss-lint": "^0.3.8", "grunt-stamp": "^0.3.0", + "htmlhint": "^0.9.13", "is-travis": "^1.0.0", "jscs": "^3.0.4", "load-grunt-tasks": "^3.4.0",