Skip to content

Instantly share code, notes, and snippets.

@codingChewie
Created November 17, 2020 20:42
Show Gist options
  • Save codingChewie/93c91b4c2808d12cf099db57dcea6587 to your computer and use it in GitHub Desktop.
Save codingChewie/93c91b4c2808d12cf099db57dcea6587 to your computer and use it in GitHub Desktop.
Validation setup for CSS files on Mac
# !/bin/bash
## date: 20-11-05
## dev: codingChewie
## purpose: validates CSS files
## version: 1.0
## name: cssvalidate.sh
CSS_DIR="" ## Directory where CSS files will be placed to be tested
CSS_JAR="" ## Location for JAR files
echo "Running CSS Valid @ $(date '+%d/%m/%Y %H:%M:%S')"
check=(`find $CSS_DIR -maxdepth 1 -name "*.css" ! -name "epub3.css"`)
if [ ${#check[@]} -gt 0 ]; then
for cssfiles in $(find "$CSS_DIR" -name "*.css" ! -name "epub3.css"); do
[ ! -e "${cssfiles}.xml" ] || rm "${cssfiles}.xml"
cd $CSS_DIR
java -jar ${CSS_JAR}/css-validator.jar --output=soap12 file:$cssfiles >> "$cssfiles".xml
done
else
echo "CSS Files not found in directory"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment