nelsyeung / usemin-cli

Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

list blocks to stdout

joh-klein opened this issue · comments

What do you think of an option like this, so just output to stdout a json with the files so that they can be used elsewhere?

The API version of this already has this function: nelsyeung/usemin, where it can return the relevant objects. I guess you just want me to incorporate it into this CLI tool where it writes it into a JSON file? Although I would recommend maybe just using the API if you want more manipulation.

Yeah, I saw that usemin api returns these things. And I was actually thinking about using it. But the cli would be enough. And maybe others (that have to support legacy projects and can't use webpack just yet) appreciate this as an option as well.

So currently I'm thinking of adding a --listblocks argument with the options stdout and filename.json which will write to stdout and a json file, respectively, from what the getBlocks function returns. Is this what you are thinking?

Sounds perfect!

Before I publish, do you mind playing around with the update I've added.
You can install from GitHub using:

git clone https://github.com/nelsyeung/usemin-cli.git
cd usemin-cli
npm link

Nice. I just tried it. Works pretty much as expected. Thanks a lot! I would have thought that --listblocks without an argument would print to stdout, but its fine either way.

I've made it default to stdout and the new version is now published. :)