From: Gustavo Martin Morcuende Date: Fri, 21 Aug 2015 16:33:23 +0000 (+0200) Subject: showcase: gulp-htmlhint X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=f99b8156ad4505ae785548c443caed0820ecbd68;p=JavaScriptForFun showcase: gulp-htmlhint --- diff --git a/angularjs/showcase/.htmlhintrc b/angularjs/showcase/.htmlhintrc new file mode 100644 index 0000000..dc75d5f --- /dev/null +++ b/angularjs/showcase/.htmlhintrc @@ -0,0 +1,14 @@ +{ + "tagname-lowercase": true, + "attr-lowercase": true, + "attr-value-double-quotes": true, + "attr-value-not-empty": false, + "attr-no-duplication" : true, + "doctype-first": true, + "tag-pair": true, + "tag-self-close": false, + "spec-char-escape": true, + "id-unique": true, + "src-not-empty": true, + "head-script-disabled": false +} \ No newline at end of file diff --git a/angularjs/showcase/gulp.config.js b/angularjs/showcase/gulp.config.js index 356a006..f479316 100644 --- a/angularjs/showcase/gulp.config.js +++ b/angularjs/showcase/gulp.config.js @@ -22,8 +22,9 @@ module.exports = function() { main + 'stubs/**/*.js' ], index: main + 'index.html', - jshintConfigurationFile: '.jshintrc', + jsHintConfigurationFile: '.jshintrc', jscsConfigurationFile: '.jscsrc', + htmlHintConfigurationFile: '.jshintrc', karmaConf: 'karma.conf.js', diff --git a/angularjs/showcase/gulpfile.js b/angularjs/showcase/gulpfile.js index b0ec792..d81f338 100644 --- a/angularjs/showcase/gulpfile.js +++ b/angularjs/showcase/gulpfile.js @@ -21,6 +21,7 @@ var serverConfig = require('./server/server.config')(); gulp.task('help', plugins.taskListing); gulp.task('default', ['help']); + /** * @ngdoc function * @@ -29,13 +30,23 @@ gulp.task('default', ['help']); * * @returns {stream} */ -gulp.task('vet', function() { +gulp.task('vet', ['vet-js', 'vet-html']); - log('*** Checking source files with JSHint and JSCS ***'); +/** + * @ngdoc function + * + * @description + * vet (evaluate) the JavaScript code and create coverage report. + * + * @returns {stream} + */ +gulp.task('vet-js', function() { + + log('*** Checking JavaScript source files with JSHint and JSCS ***'); return gulp.src(config.jsAllFiles) .pipe(plugins.if(args.verbose, plugins.print())) - .pipe(plugins.jshint(config.jshintConfigurationFile)) + .pipe(plugins.jshint(config.jsHintConfigurationFile)) .pipe(plugins.jshint.reporter('jshint-stylish', {verbose: true})) .pipe(plugins.jshint.reporter('fail')) .pipe(plugins.jscs({ @@ -48,6 +59,25 @@ gulp.task('vet', function() { * @ngdoc function * * @description + * vet (evaluate) the HTML code and create coverage report. + * + * @returns {stream} + */ +gulp.task('vet-html', function() { + + log('*** Checking HTML source files with HTMLHint ***'); + + return gulp.src(config.templates) + .pipe(plugins.if(args.verbose, plugins.print())) + .pipe(plugins.htmlhint(config.htmlHintConfigurationFile)) + .pipe(plugins.htmlhint.failReporter()); + +}); + +/** + * @ngdoc function + * + * @description * wire up bower dependencies and inject files in index.html * * @returns {Stream} diff --git a/angularjs/showcase/package.json b/angularjs/showcase/package.json index dda6cba..debc816 100644 --- a/angularjs/showcase/package.json +++ b/angularjs/showcase/package.json @@ -19,6 +19,7 @@ "gulp-bytediff": "~1.0.0", "gulp-filter": "~3.0.0", "gulp-header": "~1.2.2", + "gulp-htmlhint": "~0.3.0", "gulp-if": "~1.2.5", "gulp-inject": "~1.5.0", "gulp-jscs": "~2.0.0",