pugjs / pug-cli

Pug's CLI interface
MIT License
259 stars 63 forks source link

pug-cli ignores piping (`|`) it's output #94

Closed SubordinalBlue closed 2 weeks ago

SubordinalBlue commented 9 months ago

pug foo.pug | <any command line utility one might want to use> does not work.

Pipe is ignored and the default output file is written.

ernieIzde8ski commented 2 weeks ago

Edit: whoops, talked out my ass. This is what you want:

pug < foo.pug | <cli-tool>

example:

% pug < index.pug | cat
<!DOCTYPE html><html lang="en"><head><title></title><script type="text/javascript">if (foo) bar(1 + 5);</script></head><body><h1>Pug - node template engine</h1><div class="col" id="container"><p>Get on it!</p><p>Pug is a terse and simple templating language with a
strong focus on performance and powerful features.</p></div></body></html>

Pug only detects input streams, not output streams.

SubordinalBlue commented 2 weeks ago

You're absolutely right. I should have run pug --help to save us both the time:

    # Using `pug` over standard input and output streams
    $ pug < my.pug > my.html
    $ echo 'h1 Pug!' | pug

Edit: whoops, talked out my ass. This is what you want:

No worries; I do that too, far more often than I'd prefer. Thank you for taking the time to clear up my misunderstanding. Cheers!