diff --git a/Gruntfile.js b/Gruntfile.js index 74e9697a423f1a545eb836178f3da4e3489352ab..0deece20ce61f00c1dc12a27de20380b3d26a7fa 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 0000000000000000000000000000000000000000..636af68d76718bb3bd841cdcd58b0f27ad92766d --- /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 4fe64fd59587683e4aaac6ce3c6acc9ed330714c..2d6b598d2d454e12fbc47a1e92d4634a7317316c 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",