diff options
author | Zac Echola <zac.echola@gmail.com> | 2014-10-18 06:48:34 +0400 |
---|---|---|
committer | Zac Echola <zac.echola@gmail.com> | 2014-10-18 06:48:34 +0400 |
commit | 6f083dce6e8b3652d711602205b17831d4dc5013 (patch) | |
tree | aa6530760fb12238c80790732a0f91611df5975f /tasks | |
parent | 9dc0bfd3664db962c3ec69f099ca6d04dadfcb38 (diff) |
basic support for bootlint 0.5.0
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/bootlint.js | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/tasks/bootlint.js b/tasks/bootlint.js index ec12294..5a7342b 100644 --- a/tasks/bootlint.js +++ b/tasks/bootlint.js @@ -11,6 +11,8 @@ module.exports = function(grunt) { var bootlint = require('bootlint'); + + var msg = { start: 'Validation started for ', ok: 'Validation successful!', @@ -24,6 +26,16 @@ module.exports = function(grunt) { }); var totalErrCount = 0; + var reporter = function(lint) { + if (options.stoponerror) { + grunt.fail.warn(lint.message); + } else { + totalErrCount += 1; + grunt.log.warn(lint.message); + } + }; + + // Iterate over all specified file groups. this.files.forEach(function(f) { @@ -38,28 +50,8 @@ module.exports = function(grunt) { }) .forEach(function(filepath) { var src = grunt.file.read(filepath); - var errs = bootlint.lintHtml(src); - grunt.log.writeln(msg.start + filepath); - - // Remove relaxed errors - if (options.relaxerror.length) { - errs = errs.filter(function(elem) { - return options.relaxerror.indexOf(elem) < 0; - }); - } - - errs.forEach(function (err) { - totalErrCount += errs.length; - if (options.stoponerror) { - grunt.fail.warn(filepath + ':' + err); - } else { - grunt.log.warn(filepath + ':', err); - } - }); - - if (!errs.length) { grunt.log.ok(filepath + ' is OK! \n'); } - + bootlint.lintHtml(src, reporter, options.relaxerror); }); if (totalErrCount > 0) { |