Created
May 14, 2018 22:19
-
-
Save conmute/56c5c4b3decbf3417982b677877d8f4e to your computer and use it in GitHub Desktop.
Script to run all files through w3c checker.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
'use strict'; | |
const validate = require('html-angular-validate'); | |
validate.validate( | |
[ | |
"src/app/ui/**/*.html" | |
], | |
{ | |
customtags: ["app-*"], | |
customattrs: ["app-*", "(click)"], | |
reportpath: "log/html-validator-report.json", | |
reportCheckstylePath: "log/html-checkstyle-report.xml" | |
} | |
).then((result) => { | |
if (result.allpassed) { | |
console.log('HTML validator passed all files'); | |
} | |
if (!result.allpassed) { | |
console.log( | |
`HTML validator found errors for ` + | |
`${result.filesfailed} out of ${result.fileschecked} files total` | |
); | |
result.failed.forEach(rec => { | |
console.log(`\n * ${rec.filepath} has ${rec.numerrs} errors \n`); | |
rec.errors.forEach(err => { | |
console.log(` [${err.line}:${err.col}] ${err.msg} `); | |
}); | |
}); | |
console.log('\n') | |
} | |
// Do something with the result object | |
}, (err) => { | |
console.log('HTML validator error: ' + err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment