Skip to content

Commit 960503f

Browse files
author
Cameron Cundiff
committed
Use axe-core and set up build tools.
- gulp for watching and building with browserify - switch to axe-core for WCAG descriptions
1 parent 463ef32 commit 960503f

File tree

8 files changed

+52
-23
lines changed

8 files changed

+52
-23
lines changed

auditor.coffee

Lines changed: 0 additions & 16 deletions
This file was deleted.

gulpfile.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"use strict";
2+
3+
var watchify = require("watchify");
4+
var browserify = require("browserify");
5+
var gulp = require("gulp");
6+
var source = require("vinyl-source-stream");
7+
var gutil = require("gulp-util");
8+
var buffer = require("vinyl-buffer");
9+
var sourcemaps = require("gulp-sourcemaps");
10+
var assign = require("lodash").assign;
11+
12+
var customOpts = {
13+
entries: ["./src/index.coffee"],
14+
debug: true
15+
};
16+
var opts = assign({}, watchify.args, customOpts);
17+
var b = watchify(browserify(opts));
18+
19+
b.transform("coffeeify");
20+
gulp.task("js", bundle);
21+
b.on("update", bundle);
22+
b.on("log", gutil.log);
23+
24+
function bundle() {
25+
return b.bundle()
26+
.on("error", gutil.log.bind(gutil, "Browserify Error"))
27+
.pipe(source("bundle.js"))
28+
.pipe(buffer())
29+
.pipe(sourcemaps.init({loadMaps: true}))
30+
.pipe(sourcemaps.write("./"))
31+
.pipe(gulp.dest("./dist"));
32+
}

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
"coffee-script": "~1.9.3",
2525
"request": "~2.61.0",
2626
"express": "~4.13.3",
27-
"cors": "~2.7.1"
27+
"cors": "~2.7.1",
28+
"axe-core": "~1.1.0",
29+
"watchify": "~3.3.1",
30+
"vinyl-source-stream": "~1.1.0",
31+
"gulp-util": "~3.0.6",
32+
"lodash": "~3.10.1",
33+
"gulp-sourcemaps": "~1.5.2",
34+
"vinyl-buffer": "~1.0.0"
2835
}
2936
}

src/auditor.coffee

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Logger = require "./logger.coffee"
2+
axe = require("axe-core/axe.min.js").axe
3+
4+
class Auditor
5+
perform: ->
6+
window.axe.a11yCheck document, {}, (results) ->
7+
elements = violation.nodes[0].html for violation in results.violations
8+
Logger.log elements
9+
10+
module.exports = Auditor
File renamed without changes.
File renamed without changes.

test/app.coffee

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ express = require "express"
22
cors = require "cors"
33
app = express()
44

5-
corsOptions =
6-
origin: "http://localhost:8000"
7-
credentials: true
8-
9-
app.post "/", cors(corsOptions), (req, res) ->
5+
app.post "/", cors(), (req, res) ->
106
res.send "Success!"
117

128
app.listen 3000

test/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<html>
22
<head>
3-
<script src="../dist/accesslint-monitor.js"></script>
3+
<script src="../dist/bundle.js"></script>
44
</head>
55
<body>
66
<img src="image.jpg" />

0 commit comments

Comments
 (0)