svgo icon indicating copy to clipboard operation
svgo copied to clipboard

Option to ignore not found error?

Open shirotech opened this issue 3 years ago • 4 comments

Would like a way to not throw an error when there are no SVG files found in a folder. In certain use cases, it is not considered an "error" just simply the folder is empty. This can break some processes which rely on this command. It can be hacked, but not very elegant.

For example when the public folder does not contain any SVG files:

svgo -q -r -f public
Error: No SVG files have been found in 'public' directory.

shirotech avatar Jun 27 '22 04:06 shirotech

Echo this, not sure if there is an option?

ainsleyclark avatar Nov 07 '22 18:11 ainsleyclark

Would also like to see this resolved. I have SVGO in my site boilerplate, and some projects either don't have SVGs to parse, or don't have them yet during development. Wish this was at most a warning, not an error.

evanwarner avatar Aug 01 '23 01:08 evanwarner

I also need this functionality or at least a workaround. @shirotech can you share your approach?

zlatevbg avatar Nov 02 '23 17:11 zlatevbg

I also need this functionality or at least a workaround. @shirotech can you share your approach?

Sure, here is my current workaround:

svgo -q -r -f public/icons &> /dev/null || :

shirotech avatar Nov 02 '23 22:11 shirotech