Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output customizing #55

Open
kksandr7-deprecated opened this issue Jan 22, 2022 · 1 comment
Open

Output customizing #55

kksandr7-deprecated opened this issue Jan 22, 2022 · 1 comment

Comments

@kksandr7-deprecated
Copy link

kksandr7-deprecated commented Jan 22, 2022

Hi, I want to format the error output by handling the "error" event, but when using the "json" format, the event does not fire because a hard-coded formatter is used.

For example, validatorLog will only be called for { format: "gnu" }

const gulp = require('gulp')
const validator = require('gulp-html')

function validatorLog(e) {
    console.log('=== validatorLog ===')
    console.log(typeof e)
    console.log('=== validatorLog ===')
}

function validatorGnu() {
    return gulp.src('./index.html')
        .pipe(validator({ format: "gnu" }).on('error', validatorLog))
}

function validatorJson() {
    return gulp.src('./index.html')
        .pipe(validator({ format: "json" }).on('error', validatorLog))
}

exports.default = gulp.series(validatorGnu, validatorJson)

Also, this hard-coded formatter just prints json to the console. This is not a bug?
image

@XhmikosR
Copy link
Member

XhmikosR commented Feb 9, 2022

Happy to accept a PR that improves things, just CC me and I'll try to have a look. It always has been like that AFAICT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants