rbtech / css-purge

A CSS tool written in Node JS as a command line app or library for the purging, burning, reducing, shortening, compressing, cleaning, trimming and formatting of duplicate, extra, excess or bloated CSS.
http://rbtech.github.io/css-purge
MIT License
125 stars 19 forks source link

Feature Request: support stdin / stdout #45

Open werrolf opened 4 years ago

werrolf commented 4 years ago

For script integration and general utility, it would be nice to have the ability to 1) cosume stdin as css input 2) emit processed result on stdout

Current workflow for input seems to assume a signle local file exists with all input. This may not be the case. Direct input building via e.g. *nix cat or input fetching with wget or curl is not possible because of this assumption. A separate file building step is required in these cases.

Current workflow for output always produces a new file decorated with .min intermediate extension if the --output option is omitted. This prevents e.g. quick change detection by piping into md5sum, wc -c and so forth, or further processing by other tools. It also prevents shell-based file redirection.

The usual convention for stdin / stdout processing in command line tools is to either do it by default, in absence of file-specific options, or to recognize - as a ~magic file name referring to either stdin or stdout.

Input could potentially default to stdin. Defaulting output to stdout OTOH would break compatibility with all existing scripts using css-purge.