showcase: gulp-htmlhint
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Fri, 21 Aug 2015 16:33:23 +0000 (18:33 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Fri, 21 Aug 2015 16:33:23 +0000 (18:33 +0200)
angularjs/showcase/.htmlhintrc [new file with mode: 0644]
angularjs/showcase/gulp.config.js
angularjs/showcase/gulpfile.js
angularjs/showcase/package.json

diff --git a/angularjs/showcase/.htmlhintrc b/angularjs/showcase/.htmlhintrc
new file mode 100644 (file)
index 0000000..dc75d5f
--- /dev/null
@@ -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
index 356a006..f479316 100644 (file)
@@ -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',
 
index b0ec792..d81f338 100644 (file)
@@ -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}
index dda6cba..debc816 100644 (file)
@@ -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",