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

SVG tag is cleared #1092

Open
denkhis opened this issue Apr 26, 2021 · 2 comments
Open

SVG tag is cleared #1092

denkhis opened this issue Apr 26, 2021 · 2 comments

Comments

@denkhis
Copy link

denkhis commented Apr 26, 2021

When I run with removeEmptyElements: true mode SVG tag and its child tags is cleared in index.html

removeEmptyElements: false

<svg fill="none" height="39" viewBox="0 0 37 39" width="39"
     xmlns="http://www.w3.org/2000/svg"
     class="icon icon_solid icon_custom_blue"
     data-v-f07c3570>
  <circle cx="18.4101" cy="18.9882" fill="#707070" r="18.4101"></circle>
</svg>

removeEmptyElements: true

<svg fill="none" height="39" viewBox="0 0 37 38" width="39"
     xmlns="http://www.w3.org/2000/svg"
     class="icon icon_solid icon_custom_green"
     data-v-f07c3570>
</svg>
@denkhis
Copy link
Author

denkhis commented Apr 26, 2021

Test case:

Create index.html as

<html><body>
<svg fill="none" height="39" viewBox="0 0 37 39" width="39"
     xmlns="http://www.w3.org/2000/svg"
     class="icon icon_solid icon_custom_blue"
     data-v-f07c3570>
  <circle cx="18.4101" cy="18.9882" fill="#707070" r="18.4101"></circle>
</svg>
</body></html>

html-minifier --remove-empty-elements index.html

<html><body>
<svg fill="none" height="39" viewBox="0 0 37 39" width="39" xmlns="http://www.w3.org/2000/svg" class="icon icon_solid icon_custom_blue" data-v-f07c3570>
  
</svg>
</body></html>

@joachim-pryntad
Copy link

This also removes attributes of a inside of an . So <svg><use href="some.svg"></use></svg> becomes <svg><use></use></svg>

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