dreamzmaster / gulp-pa11y

Audit accessibility of your site using Gulp
GNU General Public License v2.0
11 stars 4 forks source link

Using pa11y in the Gulp task stream #3

Open cjduncana opened 8 years ago

cjduncana commented 8 years ago

Is there a way to use pa11y in the Gulp task stream? Something like:

var pa11y = require('gulp-pa11y');

gulp.task('build', function() {
    return gulp.src('index.html')
        .pipe(pa11y());
});

The documentation is not clear on this front. It seems to me that this would be the most common use case since it would function similarly to other Gulp plugins like linters. As of right now, if I write this code in my gulpfile.js, I would get an error. I kinda anticipated this since this kind of code is not mention in the documentation, but from reading the documentation I do not have any idea of how exactly do I use this plugin.

Any help? This seems like a great plugin.

williamgcd commented 8 years ago

I did that by creating a task like the following:

gulp.task('pa11y', pa11y({ url: config.devUrl, failOnError: true, // fail tje build on error showFailedOnly: true, // show errors only and override reporter reporter: 'console' }));

And then, on build, I just run the related task:

gulp.task('build', function(callback) { runSequence('pa11y', callback); });

Hope it helps. ;)

gautirao commented 6 years ago

hi can this plugin work on saved html files ? looks like only the url is used