Documentation
CSS Validation
ALL CSS files in a title (excluding the templated epub3.css) must be validated through w3c's validator. While browser errors may occur this is to insure that standard CSS is valid.
AppleScript
Use the AppleScript app css-validator.app. css-validator does support drag and drop.
Terminal
Gist:
The above shell script assumes the required JARs were downloaded from w3c. It is strongly suggested to create a directory for scripts and jar files and run all scripts in a separate directory from the files, example:
Points to a directory where all CSS files go:
bash1CSS_DIR="${HOME}/validation/css"
Points to a directory for all the JAR files:
bash1CSS_JAR="${HOME}/scripts/css_jar"
to run the command execute bash cssvalidate.sh
in the terminal. This file can be executable with:
bash1chmod +x cssvalidate.sh
Another option is to add this to your .bash_profile:
bash1cd && nano .bash_profile
add:
bash1alias cssvalid='bash ~/path/to/file/cssvalidate.sh'
make sure to do a .bash_profile reboot:
bash1. .bash_profile
now the shell command (cssvalid
) will work in the terminal.
Whitespace
CSS files should be the smallest size possible and while we do not compress we do make sure the CSS is clean. One area to help in file size is the removal of whitespace, regex:
bash1## Find:2^[[:blank:]]*$\r34## Replace:
Semi-colon
For some reason a missing semi-colon may not show up when the CSS file is tested with a vaildator or the ePub is ran through epubcheck but after experiencing app crashes with Adobe Digital Editions that could be traced back to a simple missing semi-colon. It's a good practice to check your CSS file, regex:
bash1## Find:2[^{};, ^\n\t]( |)$34## Replace: