Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Allow reading code from STDIN, and output on STDOUT #1

CHH opened this Issue · 3 comments

2 participants


I'm the author of an asset pipeline for PHP ( 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
@davglass davglass was assigned

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..

@davglass davglass closed this in 3c101d3

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

Awesome! Thanks :smile:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.