I'm having a hard time trying to extract my css using purgecss from a command line to a separate file. The instruction on the PurgeCSS.com for using the commandline are not specific enough:
By default, the CLI outputs the result in the console. If you wish to return the CSS as files, specify the directory to write the purified CSS files to:
purgecss --css css/app.css --content src/index.html "src/**/*.js" --output build/css/
I've tried a variation of the above code, and all I've managed to do is to print the code to the command line or get an error.
What I've tried:
purgecss --css bootstrap.css --font.css --juan.css --content index.html --output build/css/
purgecss --css bootstrap.css --font.css --juan.css --content index.html "assets" --output build/css/
purgecss --css bootstrap.css --font.css --content index.html "/assets" --output
If anyone out there knows how to correctly output my css to a specific file, I would really appreciate it.
PurgeCSS will error if the output directory does not exist. Provided your output directory exists, your script for PurgeCSS should work. PurgeCSS does not seem to mind whether there is a slash at the end of the directory.