Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

STDIN and pipe support #15

Closed
barbazul opened this Issue · 1 comment

2 participants

@barbazul

I noticed the command has STDIN support built in but it's commented out. I tried uncommenting it and running uglifycss < test.css with great success. However when I tried running something like lessc test.less | uglifycss > test.css it "hangs" (it's actually waiting for input).

It would be great to have support for pipe commands.

I toyed around with the code and got it to work without changing much.
Some checking would be required to detect if there actually is input to be expected and throw usage() otherwise

/*
// . usage
} else {
    usage();
}

*/
// . stdin
} else {
    //stdin = process.openStdin();
    stdin = process.stdin;
    stdin.resume();
    stdin.setEncoding("utf8");
    content = '';
    stdin.on('data', function(part) {
        content += part;
        util.print(uglifycss.processString(part, params.options));
        process.exit();
    });
/*
    stdin.on('end', function() {
        util.print(uglifycss.processString(content, params.options));
    });
*/
}
@fmarcia
Owner

Thanks for your input. I'll review it soon.

@fmarcia fmarcia closed this issue from a commit
Franck Marcia add stdin/pipe support ; fix #15
thanks to @barbazul and Mathias Bynens http://stackoverflow.com/a/15485424
d8fd51e
@fmarcia fmarcia closed this in d8fd51e
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.