I'm the author of an asset pipeline for PHP (http://github.com/CHH/pipe). For tool support it would be nice if yuglify would support piping JS/CSS into STDIN, and then outputting the minified code to STDOUT — just like the underlying uglifyjs.
An asset pipeline, has a filter pipeline where the output from the last filter gets put into the next filter. When using yuglifyjs in it's current state in a such filter pipeline, the tool needs to write the input data to a temporary file, and read the output back from another temporary file, which is cumbersome to use.
Switching between CSS and JS compression could be done via a flag, for example --css and --js.
% echo "foo" | yuglify --js
% echo "foo" | yuglify --css
I wasn't planning on adding a "nice" cli option for this since it was primarily used as a node dependency, but I'll look into this today and get at least this added..
Fixes #1 - Added support for --terminal, --type and --output
I added a --terminal flag to tell it when to read from stdin (personal preference, I hate assumptions).
So this now works:
cat foo.js | yuglify --type js --terminal //Prints to stdout
cat foo.css | yuglify --type css --terminal //Prints to stdout
cat foo.js | yuglify --type js --terminal --output ./foo-min.js
cat foo.css | yuglify --type css --terminal --output ./foo-min.css