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

Instructions for how to use as npm module #21

Open
Svish opened this issue Nov 11, 2019 · 3 comments
Open

Instructions for how to use as npm module #21

Svish opened this issue Nov 11, 2019 · 3 comments

Comments

@Svish
Copy link

Svish commented Nov 11, 2019

Currently there's only some (to me) rather confusing instructions for how to use this on a Mac. Would it be possible to maybe add some instructions for how to use this via npm/npx/git directly?

@AndreyKozlov1984
Copy link
Collaborator

AndreyKozlov1984 commented Nov 11, 2019

Hi, Svish, what is the exact issue? If you want to use this from a command line for manual work, the current readme instruction is the best. But, if you want to use this from your program, the best thing is to use it this way, for example:

import autoCropSvg from 'svg-autocrop';

const croppedSvg = await autoCropSvg("<svg>...</svg>", {title: `my logo`});

Thanks for pointing to the issue, I'll add an example to the readme.

@Svish
Copy link
Author

Svish commented Nov 11, 2019

That there would be a great example to have in the readme, yes. 😊

The issue with the current example is that there's a lot of stuff that doesn't seem relevant to me (I'm on Windows). So it would be great with an example that assumes the user already has the needed tools installed (node and npm) and only focuses on how to install and use the tool. For example what parameters are available for the svg-autocrop command. From what I've managed to decipher from the code, there seems to be at least a default, which assumes there's an input and output directory where you run it, but there also seems to be a --recursive flag or something...

Anyways, would just be super great with some simple and focused instructions on how to use this tool. Seems it does exactly what I've been looking for for quite a while, but up till now have done sort of manually in a text-editor. 😕👍

@AndreyKozlov1984
Copy link
Collaborator

Ok, I'll try to improve the command line version to provide reasonable options and description. At this moment it is expected that there is an input directory with svg files and there is an output directory, that is how it is used internally for CNCF.

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

No branches or pull requests

2 participants