yargalot / gulp-accessibility

Gulp plugin for AccessSniff
48 stars 12 forks source link

Test against URL's #4

Closed TheDutchCoder closed 8 years ago

TheDutchCoder commented 9 years ago

Since the plugin is working now (although it throws an error when you don't specify the "force: true" object), would it be possible to test against URL's?

Right now it's not much use to static site builds, so that would be great!

yargalot commented 9 years ago

Yeh the force: true thing isnt ideal, I'll fix that up with a patch. Not sure how to fail a gulp task gracefully at the moment, so will need to look at that.

Anyway, AccessSniff supports urls so it should be a matter of passing through a url via gulp, which I need to look at. Gulp seems to not like url entries as a file, so will have a think.

yargalot commented 9 years ago

Does some like below make sense?

gulp.task('accessSniff-url', function() {
  return access({
    urls: ['http://statamic.com/'],
    force: true,
    reportType: 'json',
    reportLocation: 'reports/json',
  });
});
yargalot commented 9 years ago

Right did a quick release to 1.2.0, so try out the above and see what you reckon.

TheDutchCoder commented 9 years ago

That looks good, I'll give it a try today and will report back!

TheDutchCoder commented 9 years ago

This works like a charm man, excellent! Is there a way to combine reports and set their filename?

I'm not sure what options you expose right now, but that would be a really nice thing.

I see you use AccessSniff's options, nice! I will see what I can do with that.

Thanks for your time, it's really appreciated!

yargalot commented 9 years ago

Well, been thinking about doing that with the report, just been slack with putting it in, if you put in an issue over at yargalot/AccessSniff it'll give me a reason to do it.

With the options, you can pretty much pass in whatever is over at yargalot/AccessSniff as well.

Let me know if there is anything else thats missing, happy to have a look at throwing things in, got a few things I need to fix with it.

But since this issue is all good, I'll close it off :)

TheDutchCoder commented 9 years ago

Created an issue over at AcessSniff.

On another note: would you be able to make this plugin work in a regular stream?

E.g.

return gulp.src('package.json')
    .pipe(plugins.plumber())
    .pipe(plugins.accessibility(accessibility.options))
    .pipe(plugins.rename('test.txt'))
    .pipe(gulp.dest('.tests/wcag'));

Right now I can only run it directly as

plugins.accessibility(accessibility.options)

and I would like to pipe the results to a file (although this might be very much related to the reports issue)

yargalot commented 9 years ago

Yeh that should be fine, would just have to return the output in the callback. Will have a look this weekend.