Skip to content

Commit 5b3ee86

Browse files
committed
readme
1 parent 218d791 commit 5b3ee86

File tree

2 files changed

+25
-44
lines changed

2 files changed

+25
-44
lines changed

README.md

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,47 @@ Run your critical pages through [pa11y](https://github.com/pa11y/pa11y) and fail
66
77
## Demo
88

9-
https://netlify-plugin-a11y.netlify.com/
9+
The demo site is a Gatsby blog that has been modified to have some inaccessible elements: https://netlify-plugin-a11y.netlify.com/
1010

11-
## Overview
11+
- the [Hello World](https://netlify-plugin-a11y.netlify.com/hello-world/) page has an image with no `alt` text
12+
- the [Second Post](https://netlify-plugin-a11y.netlify.com/my-second-post/) page has a form no submit button, and an input with no label.
1213

13-
Run axe-cli and fail build if accessibility failures are found.
14+
You can see the impact of the plugin in the deploy logs of this demo site: https://app.netlify.com/sites/netlify-plugin-a11y/deploys. By default, the plugin is set to error on failure.
1415

15-
## Demonstration
1616

17-
See this plugin being used in this simplified demo site:
18-
19-
You can switch to `resultMode = "warn"` so that builds don't fail:
17+
But if that is too drastic, you can switch to `resultMode = "warn"` so that builds don't fail:
2018

2119
![image](https://user-images.githubusercontent.com/6764957/77146484-868d4a80-6a61-11ea-84cc-703c2abd6d6e.png)
2220

2321
## Usage
2422

25-
### Prerequisites
23+
To install, add the following lines to your `netlify.toml` file:
24+
25+
```toml
26+
[[plugins]]
27+
package = "netlify-plugin-a11y"
2628

27-
- npm and node
28-
- @Netlify/build (later this will be included in the Netlify CLI)
29-
- A free [Netlify account](https://netlify.com)
30-
- Opt-in to Netlify Build Plugin feature support (Not yet publicly available, sorry)
29+
# all inputs are optional, we just show you the defaults below
30+
[plugins.inputs]
31+
32+
# required config
33+
checkPaths = ['/'] # you can give an array of directories or paths to html files, that you want to run a11y checks on
34+
35+
# # optional config
36+
# resultMode = "warn" # is "error" by default
3137

38+
# # Developer only
39+
# debugMode = true # extra logging for plugin developers
40+
```
3241

3342
### Including this plugin in a project
3443

3544
This plugin can be included via npm. Install it as a dependency for your project like so:
3645

3746
```
38-
npm install --save netlify-plugin-axe
47+
npm install --save netlify-plugin-a11y
3948
```
4049

41-
### Configuration
42-
43-
This plugin will fetch the specified feeds and stash their data prior to the execution of the `build` command you have specified in your Netlify configuration. The desired feeds can be specified in the `netlify.toml` config file. For simpler configuration syntax, I recommend using yaml rather than toml by instead including a `netlify.yml` file.
44-
45-
To use plugins, a `plugins` array should be specified in your `netlify.yml`. Each plugin can then be specified with its parameters like so:
46-
47-
```yaml
48-
plugins:
49-
- netlify-plugin-axe:
50-
# type: ./path-to-plugin-file | npm-module-name
51-
type: netlify-plugin-fetch-feeds
52-
config:
53-
site: mycoolsite.netlify.com # your Netlify site url
54-
# https://github.com/dequelabs/axe-cli#running-specific-rules
55-
axeFlags: --tags wcag2a
56-
```
57-
58-
5950
### Execution in Netlify
6051

6152
Once installed and configured, the plugin will automatically run in the Netlify CI during its specified Netlify Build lifecycle event.
@@ -73,13 +64,3 @@ npm install @netlify/build -g
7364
netlify-build
7465
```
7566

76-
77-
## Issues
78-
79-
- https://github.com/jaimeiniesta/serverless-axe-cli/pull/1
80-
- https://github.com/adieuadieu/serverless-chrome/issues/143
81-
- https://gist.github.com/stephenmathieson/57c1fa4a8a6bdbb489f91d4a4f713ee9
82-
- npm install chromedriver
83-
- https://github.com/SeleniumHQ/selenium/issues/4863
84-
- https://www.selenium.dev/documentation/en/webdriver/driver_requirements/
85-
- https://github.com/dequelabs/axe-cli/issues/84

plugin/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function netlifyPlugin(conf) {
4545
`[${chalk.cyan.bold(res.documentTitle)} (${path.relative(
4646
process.cwd(),
4747
res.pageUrl
48-
)})] ${chalk.pink(res.type)} ${chalk.cyan(res.typeCode)}: ${
48+
)})] ${chalk.magenta(res.type)} ${chalk.cyan(res.typeCode)}: ${
4949
res.message
5050
} (${chalk.cyan(res.context)})`
5151
);
@@ -58,13 +58,13 @@ function netlifyPlugin(conf) {
5858
} else {
5959
results.forEach((res) => {
6060
console.warn(
61-
`${chalk.pink(res.type)} ${chalk.cyan(res.typeCode)}: ${
61+
`${chalk.magenta(res.type)} ${chalk.cyan(res.typeCode)}: ${
6262
res.message
6363
} (${chalk.cyan(res.context)})`
6464
);
6565
});
6666
console.warn(
67-
chalk.pink(
67+
chalk.magenta(
6868
`${results.length} accessibility issues found! Check the warnings.`
6969
)
7070
);

0 commit comments

Comments
 (0)