Skip to content

Instantly share code, notes, and snippets.

@oliverlundquist
Created August 16, 2018 08:18
Show Gist options
  • Save oliverlundquist/0f477b564c0e6aec598f52a71a942169 to your computer and use it in GitHub Desktop.
Save oliverlundquist/0f477b564c0e6aec598f52a71a942169 to your computer and use it in GitHub Desktop.
W3C html and css validation
#!/bin/bash
HTML_FILES=$(find ${1} -name '*.html' -type f)
CSS_FILES=$(find ${1} -name '*.css' -type f)
OUTPUT_FILE=results.txt
> $OUTPUT_FILE
for file in ${HTML_FILES[*]}
do
echo "File: $file" >> $OUTPUT_FILE
echo '--------------------------' >> $OUTPUT_FILE
curl -s -S -H "Content-Type: text/html; charset=utf-8" --data-binary "@$file" https://validator.w3.org/nu/?out=gnu >> $OUTPUT_FILE
echo '' >> $OUTPUT_FILE
done
for file in ${CSS_FILES[*]}
do
echo "File: $file" >> $OUTPUT_FILE
echo '--------------------------' >> $OUTPUT_FILE
curl -s -S -H "Content-Type: text/css; charset=utf-8" --data-binary "@$file" https://validator.w3.org/nu/?out=gnu >> $OUTPUT_FILE
echo '' >> $OUTPUT_FILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment