Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support stdin, stdout #4

Open
btubbs opened this issue May 19, 2016 · 1 comment
Open

Support stdin, stdout #4

btubbs opened this issue May 19, 2016 · 1 comment

Comments

@btubbs
Copy link

btubbs commented May 19, 2016

It would be a lot easier to use inky-cli in my Makefile if it could accept input on stdin, and print output to stdout. As it is, I'm going to have to create temporary files in between inky processing and CSS inlining.

(I know you have your own pipeline of Grunt tasks, but I don't want to use Grunt.)

A common CLI pattern is to use a dash ("-") as the filename argument to signal that input should be read from stdin instead of a file, or be printed to stdout instead of a file. Could inky-cli do that?

@rclmenezes
Copy link

rclmenezes commented Dec 12, 2016

For now, I made a handy dandy script:

const Inky = require('inky').Inky;
const cheerio = require('cheerio');
const getStdin = require('get-stdin');

const options = {};
const inky = new Inky(options);
getStdin().then(input => {
    const html = cheerio.load(input);
    const convertedHtml = inky.releaseTheKraken(html);
    console.log(convertedHtml);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants