So I'm trying to svgo in a project which does not, and will not have node.
The project has its own require function, etc.
Note:
I'm trying to use svgo similar to this:
https://github.com/svg/svgo/blob/master/examples/test.js
Except I already have the svg file as a string... in fact there is no svg file on the filesystem.
svgo has a bunch of npm dependancies, some of which may be easy to remove.
Here are some guesses from me:
Perhaps svgo needs to be modularized into even more packages?
If you bundle svgo using Broserify, it will only bundle the dependencies required by the entrypoint. Thus, the CLI dependencies won't be included.
Hello! Sorry for the late response.
fs, and js-yaml are only used to load configuration from a yml file,
Yes, but fs is also used to load and save files (full folders). So, yes, if you pass in everything they aren't needed, that's true.
coa and mkdir are only used when svgo is run from the command line, and since I want to use svgo as a js library, I don't need that?
Yep.
colors is only used when using the convertcolor plugin, which I don't need.
Are you talking about require('colors'); in coa.js? It's being used for coloring CLI. Quick search in the repo shows, that's there no other colors.
It seems as if svgo could be easily split into svgo and svgo-cli.
Yeah, but people got used to npm install svgo for the CLI utility, so I don't think it's a good idea to change this for sake of backward compatibility. It can break many CI-processes.
What about svgo-core and svgo?
Maybe. But it's not on top of priorities.
@derhuerst See also https://github.com/svg/svgo/issues/436
@ben-eb Thanks!
Let's close this in favor of #436 because that issue fits better.
Most helpful comment
What about
svgo-coreandsvgo?