@caweb/a11y-webpack-plugin 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +12 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -133,7 +133,17 @@ class A11yPlugin {
|
|
|
133
133
|
|
|
134
134
|
console.log(`<i> ${boldGreen('[webpack-dev-middleware] Running IBM Accessibility scan...')}`);
|
|
135
135
|
|
|
136
|
-
this.a11yCheck(path.join(process.cwd(), output.publicPath ?? '/' ), this.config );
|
|
136
|
+
let result = this.a11yCheck(path.join(process.cwd(), output.publicPath ?? '/' ), this.config );
|
|
137
|
+
|
|
138
|
+
if( result ){
|
|
139
|
+
// we have to inject the a11y.update.js file into the head in order for the webpack-dev-server scripts to load.
|
|
140
|
+
let pageContent = fs.readFileSync(path.join(staticDir.directory, `${this.config.outputFilename}.html`))
|
|
141
|
+
|
|
142
|
+
fs.writeFileSync(
|
|
143
|
+
path.join(staticDir.directory, `${this.config.outputFilename}.html`),
|
|
144
|
+
pageContent.toString().replace('</head>', '<script src="/a11y.update.js"></script>\n</head>')
|
|
145
|
+
)
|
|
146
|
+
}
|
|
137
147
|
|
|
138
148
|
console.log(`<i> ${boldGreen('[webpack-dev-middleware] IBM Accessibilty Report can be viewed at')} ${ boldBlue(new URL(`${hostUrl}/${this.config.outputFilename}.html`).toString()) }`);
|
|
139
149
|
|
|
@@ -228,8 +238,7 @@ class A11yPlugin {
|
|
|
228
238
|
resolveBin('accessibility-checker', {executable: 'achecker'}),
|
|
229
239
|
acheckerArgs,
|
|
230
240
|
{
|
|
231
|
-
stdio: 'pipe'
|
|
232
|
-
timeout: 30000 // stop after 30 seconds
|
|
241
|
+
stdio: 'pipe'
|
|
233
242
|
}
|
|
234
243
|
)
|
|
235
244
|
|