First install the package:
cd css-valid && npm i && npm link
If the CLI is used the results will be written to an XML file specified by what exists in output if there is an error or warning. If no error or warning are found then the terminal will return:
File: filename.css Errors: 0 Warnings: 0
CompletedThe CLI can be used by calling either:
cssvalidclior
cvcliQuick example run on a title's CSS directory with an exclusion:
vcli -i '/Users/codingChewie/title/OEBPS/css' -e epub3.css
If you forget or want to know the commands:
cvcli --helpBasic usage:
cvcliInput accepts a directory parameter to read. If no file is found in the terminal scope a Completed will be echoed in the terminal.
cvcli -i cssIf the scope is invalid or directory doesn't exist the terminal will echo:
Error: Not a valid directoryOutput is if the XML files should be written to a different location.
cvcli -o whereverThere are two shortcuts:
desktop: outputs XML files to the desktop directorydocsordocuments: outputs XML files to the Documents directory
cvcli -o desktopIf wanting to only pass in a file instead of reading an entire directory use f flag:
cvcli -i test -f idGeneratedStyles.cssCommand reads into a directory named test for a file named idGeneratedStyles.css.
If a workflow CSS is to be included and a test isn't needed then use -e flag:
cvcli -i test -e epub3.cssCommand reads into a directory named test but excludes a file named epub3.css.
Since W3C's jar by default outputs to an XML file the CLI will write and errors or warnings to an XML file by the filename, example.
- CSS file to test was named: idGeneratedStyles.css
- If any errors or warnings are found the XML file will be named: idGeneratedStyles.css.xml