Skip to content

Instantly share code, notes, and snippets.

@coord-e
Created July 16, 2020 00:00
Show Gist options
  • Save coord-e/f76e43e2249aed88737c96e77ec17b71 to your computer and use it in GitHub Desktop.
Save coord-e/f76e43e2249aed88737c96e77ec17b71 to your computer and use it in GitHub Desktop.
Validate HTML/CSS using Web API
#!/bin/bash
shopt -s globstar
for file in **/*.html; do
curl -fsS "https://validator.w3.org/nu/?out=gnu" \
-H "Content-Type: text/html; charset=utf-8" \
--data-binary "@$file" \
| { ! grep -z error; }
done
for file in **/*.css; do
curl -fsS "https://jigsaw.w3.org/css-validator/validator" \
-H "Content-Type: multipart/form-data" \
-F warning=2 -F output=text -F "text=<$file" \
| { ! grep -z errors; }
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment