tigt / mini-svg-data-uri

Small, efficient encoding of SVG data URIs for CSS, HTML, etc.
https://npm.runkit.com/mini-svg-data-uri
MIT License
309 stars 16 forks source link

Feature request: usable via command line #16

Closed AFlowOfCode closed 3 years ago

AFlowOfCode commented 4 years ago

This is a cool utility, after I found it I started using it all the time. Thank you for this & the research behind it!

I think it could be even more useful and efficient used directly from the command line. It's really so simple and needs only one piece of external data (the svg code). Being able to run something like $ svg2data optimized.svg optimized.svg.datauri would make this 💯 vs going through node prompt / js file / online for standalone file conversions.

tigt commented 4 years ago

Yeah, makes perfect sense to me. What would be the simplest way this could possibly work? The bin key in package.json?

On Tue, Jun 9, 2020, 10:00 PM A Flow of Code notifications@github.com wrote:

This is a cool utility, after I found it I started using it all the time. Thank you for this & the research behind it!

I think it could be even more useful and efficient used directly from the command line. It's really so simple and needs only one piece of external data (the svg code). Being able to run something like $ svg2data optimized.svg optimized.svg.datauri would make this 💯 vs going through node prompt / js file / online for standalone file conversions.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tigt/mini-svg-data-uri/issues/16, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5S2SWALALG5IACHNVZNNLRV3SKVANCNFSM4NZ52D6Q .

AFlowOfCode commented 4 years ago

I haven't made a node cli tool before but I do know that's where the actual command is defined along with which script it should run. Then it might just be handling the arguments & writing to a file.

I'm pretty swamped at the moment but maybe if I can find some time in the next couple weeks I'll give it a shot if it has yet to be done. I'd love to make an alias that runs svgo and then this in one go.

tigt commented 4 years ago

I’ll see what I can do this weekend. Off the top of my head, the output file should probably have .uri by default, as that maps to text/uri-list in most extension-interpreting libraries.

tigt commented 3 years ago

Implemented by #19