Open adrianosmond opened 10 months ago
Unfortunately the commented fixture doesn't run in tests right now, because babel can't parse it, so I'm not sure how we'd verify the fix.
I'm almost definitely misunderstanding something, but isn't it being run on line 208 of test/sanity.js
?
I cloned the repo and ran npm run test
with both the existing and the FA6 style comment in that fixture and got one result that looked like a success and one that looked like a failure to me.
ohh right, sorry, it's only svgo: false that's commented out. i'll look into it.
This seems like it's a babel parse error, so it's something babel would have to fix. Could you file it there?
I think you're wrong there. Babel is erroring, but that's because Babel is being asked to parse an XML comment as JSX and it isn't valid JSX.
I did a little investigation and the issue is coming from the fact that SVGO deliberately doesn't remove these comments by default as they're apparently a convention used for copyright/licensing. https://github.com/svg/svgo/issues/1811
hm, ok. in that case i'm not sure what the solution is, since this plugin uses babel to parse SVGs.
An extra
!
has been added in the comments in the SVGs in Font Awesome 6, so they change from<!-- Font Awesome Pro 5...
to<!--! Font Awesome Pro 6...
I believe this additional
!
is causing issues for this plugin.Steps to reproduce
test/fixtures/commented.svg
in this repository, adding an extra!
between the<!--
and theF
which is currently the first non-whitespace character. It doesn't seem to matter if you add more whitespace before the extra!
, as long as the!
is the first non-whitespace character.Expected behavior
Actual behavior