FullHuman / purgecss

Remove unused CSS
https://purgecss.com
MIT License
7.8k stars 248 forks source link

Allow CLI to read the CSS from stdin #251

Closed mhhollomon closed 2 years ago

mhhollomon commented 4 years ago

I would like for there to be a way that the purgecss CLI could read the CSS from stdin.

I would like to be able to do something like:

tailwind build site/mystyles.css | purgecss --css - -c purgeccs.config.js -o build/mystyles.css

Maybe there is a way to do this, but I couldn't see it after looking at the code.

My other two options are

  1. use a temp file in the middle
  2. write my own wrapper for purgecss.
mhhollomon commented 4 years ago

If it helps anyone else, I created purgecss_stdin as a (very) simple wrapper around the API to read CSS from stdin. It can write to either stdout or to a file.

Ffloriel commented 4 years ago

Thanks, could be useful. I'll look into the PR this week and if we could include the purgecss_stdin option to the CLI.

mhhollomon commented 4 years ago

I'll be happy to create a PR for this issue as well, but wanted to build it on top of the other one.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.