jakearchibald / svgomg

Web GUI for SVGO
https://jakearchibald.github.io/svgomg/
MIT License
5.76k stars 476 forks source link

Removes group element #444

Open seahindeniz opened 2 months ago

seahindeniz commented 2 months ago

I have a logo which contains multiple groups, and the SVGOMG removes a group which is a part of the structure.

Simple version

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  <g id="Icon" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round">
    <g id="y" stroke-width="1.1">
      <path d="M9.18 11.26, L12 15.2, L14.8 11.25" />
      <path d="M12 15, L12 18" />
    </g>
    <g id="House" stroke-width="2">
      <path id="Roof" d="M2 10L12 2L22 10" />
      <path id="Walls" d="M5 21V8M19 21V8" />
      <path id="Floor" d="M5 21H19" />
    </g>
  </g>
</svg>

Show original enabled: image

Disabled: image

<svg width="95" height="24" viewBox="0 0 95 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  <g id="Logo">
    <g id="Icon">
      <g id="House" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
        stroke-width="2">
        <path stroke-dasharray="21" stroke-dashoffset="21" d="M5 21H19">
          <animate fill="freeze" attributeName="stroke-dashoffset" dur="0.2s" values="21;0" />
        </path>
        <path stroke-dasharray="15" stroke-dashoffset="15" d="M5 21V8M19 21V8">
          <animate fill="freeze" attributeName="stroke-dashoffset" begin="0.2s" dur="0.2s"
            values="15;0" />
        </path>
        <path stroke-dasharray="26" stroke-dashoffset="26" d="M2 10L12 2L22 10">
          <animate fill="freeze" attributeName="stroke-dashoffset" begin="0.5s" dur="0.4s"
            values="26;0" />
        </path>
      </g>
      <g id="y" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
        stroke-width="1.13">
        <path stroke-dasharray="10" stroke-dashoffset="10" d="M9.18 11.26, L12 15.2, L14.8 11.25">
          <animate fill="freeze" attributeName="stroke-dashoffset" begin="0.2s" dur="0.4s"
            values="10;0" />
        </path>
        <path stroke-dasharray="10" stroke-dashoffset="10" d="M12 15, L12 18">
          <animate fill="freeze" attributeName="stroke-dashoffset" begin="0.5s" dur="0.4s"
            values="10;0" />
        </path>
      </g>
    </g>
    <g id="Brand">
      <path id="yonetim.cc"
        d="M26.355 23.48C26.085 23.48 25.785 23.425 25.455 23.315C25.135 23.215 24.85 23.095 24.6 22.955L25.335 21.35C25.505 21.44 25.66 21.51 25.8 21.56C25.95 21.62 26.08 21.65 26.19 21.65C26.4 21.65 26.585 21.59 26.745 21.47C26.905 21.36 27.035 21.195 27.135 20.975L28.02 18.89L30.405 12.8H32.58L29.175 20.945C28.965 21.445 28.745 21.885 28.515 22.265C28.285 22.655 28 22.955 27.66 23.165C27.33 23.375 26.895 23.48 26.355 23.48ZM27.495 20.3L24.06 12.8H26.235L28.74 18.89L29.385 20.3H27.495ZM36.7882 20.48C36.0282 20.48 35.3482 20.315 34.7482 19.985C34.1582 19.645 33.6932 19.18 33.3532 18.59C33.0232 18 32.8582 17.32 32.8582 16.55C32.8582 15.78 33.0232 15.1 33.3532 14.51C33.6832 13.92 34.1432 13.46 34.7332 13.13C35.3232 12.79 35.9982 12.62 36.7582 12.62C37.5282 12.62 38.2082 12.79 38.7982 13.13C39.3882 13.46 39.8482 13.92 40.1782 14.51C40.5082 15.1 40.6732 15.78 40.6732 16.55C40.6732 17.32 40.5082 18 40.1782 18.59C39.8482 19.18 39.3882 19.645 38.7982 19.985C38.2182 20.315 37.5482 20.48 36.7882 20.48ZM36.7882 18.65C37.1582 18.65 37.4832 18.56 37.7632 18.38C38.0432 18.2 38.2582 17.955 38.4082 17.645C38.5682 17.325 38.6482 16.96 38.6482 16.55C38.6482 16.14 38.5682 15.78 38.4082 15.47C38.2482 15.15 38.0232 14.9 37.7332 14.72C37.4532 14.54 37.1282 14.45 36.7582 14.45C36.3982 14.45 36.0732 14.54 35.7832 14.72C35.5032 14.9 35.2832 15.15 35.1232 15.47C34.9632 15.78 34.8832 16.14 34.8832 16.55C34.8832 16.96 34.9632 17.325 35.1232 17.645C35.2832 17.955 35.5082 18.2 35.7982 18.38C36.0882 18.56 36.4182 18.65 36.7882 18.65ZM41.979 20.3V12.8H43.839L43.959 14.18V20.3H41.979ZM46.944 20.3V16.46H48.924V20.3H46.944ZM46.944 16.46C46.944 15.95 46.884 15.555 46.764 15.275C46.654 14.995 46.494 14.795 46.284 14.675C46.074 14.545 45.829 14.48 45.549 14.48C45.039 14.47 44.644 14.625 44.364 14.945C44.094 15.265 43.959 15.74 43.959 16.37H43.299C43.299 15.57 43.414 14.895 43.644 14.345C43.884 13.785 44.214 13.36 44.634 13.07C45.064 12.77 45.564 12.62 46.134 12.62C46.724 12.62 47.229 12.74 47.649 12.98C48.069 13.22 48.389 13.595 48.609 14.105C48.829 14.605 48.934 15.255 48.924 16.055V16.46H46.944ZM53.8944 20.48C53.1544 20.48 52.4994 20.315 51.9294 19.985C51.3594 19.645 50.9094 19.18 50.5794 18.59C50.2594 18 50.0994 17.32 50.0994 16.55C50.0994 15.78 50.2644 15.1 50.5944 14.51C50.9344 13.92 51.3944 13.46 51.9744 13.13C52.5644 12.79 53.2394 12.62 53.9994 12.62C54.6594 12.62 55.2644 12.795 55.8144 13.145C56.3744 13.485 56.8194 13.99 57.1494 14.66C57.4894 15.32 57.6594 16.125 57.6594 17.075H51.9744L52.1544 16.895C52.1544 17.265 52.2444 17.59 52.4244 17.87C52.6144 18.14 52.8544 18.35 53.1444 18.5C53.4444 18.64 53.7644 18.71 54.1044 18.71C54.5144 18.71 54.8494 18.625 55.1094 18.455C55.3694 18.275 55.5694 18.045 55.7094 17.765L57.4794 18.455C57.2694 18.875 56.9944 19.24 56.6544 19.55C56.3244 19.85 55.9294 20.08 55.4694 20.24C55.0094 20.4 54.4844 20.48 53.8944 20.48ZM52.2594 15.785L52.0794 15.605H55.6944L55.5294 15.785C55.5294 15.425 55.4444 15.14 55.2744 14.93C55.1044 14.71 54.8944 14.55 54.6444 14.45C54.4044 14.35 54.1694 14.3 53.9394 14.3C53.7094 14.3 53.4644 14.35 53.2044 14.45C52.9444 14.55 52.7194 14.71 52.5294 14.93C52.3494 15.14 52.2594 15.425 52.2594 15.785ZM61.9001 20.48C61.0701 20.48 60.4401 20.275 60.0101 19.865C59.5901 19.455 59.3801 18.87 59.3801 18.11V10.46H61.3601V17.675C61.3601 17.995 61.4301 18.24 61.5701 18.41C61.7101 18.57 61.9151 18.65 62.1851 18.65C62.2851 18.65 62.3951 18.63 62.5151 18.59C62.6351 18.54 62.7601 18.47 62.8901 18.38L63.5801 19.865C63.3401 20.045 63.0701 20.19 62.7701 20.3C62.4801 20.42 62.1901 20.48 61.9001 20.48ZM58.1651 14.48V12.8H63.2351V14.48H58.1651ZM64.9652 20.3V12.8H66.9452V20.3H64.9652ZM65.9552 11.585C65.6552 11.585 65.3902 11.475 65.1602 11.255C64.9302 11.025 64.8152 10.755 64.8152 10.445C64.8152 10.135 64.9302 9.86999 65.1602 9.64999C65.3902 9.41999 65.6552 9.30499 65.9552 9.30499C66.2652 9.30499 66.5302 9.41999 66.7502 9.64999C66.9802 9.86999 67.0952 10.135 67.0952 10.445C67.0952 10.755 66.9802 11.025 66.7502 11.255C66.5302 11.475 66.2652 11.585 65.9552 11.585ZM68.771 20.3V12.8H70.631L70.721 13.775C70.951 13.395 71.246 13.11 71.606 12.92C71.966 12.72 72.366 12.62 72.806 12.62C73.416 12.62 73.926 12.75 74.336 13.01C74.756 13.27 75.061 13.67 75.251 14.21C75.471 13.7 75.781 13.31 76.181 13.04C76.581 12.76 77.046 12.62 77.576 12.62C78.456 12.62 79.126 12.9 79.586 13.46C80.046 14.01 80.276 14.86 80.276 16.01V20.3H78.296V16.46C78.296 15.95 78.241 15.555 78.131 15.275C78.021 14.995 77.871 14.795 77.681 14.675C77.491 14.545 77.266 14.48 77.006 14.48C76.526 14.47 76.156 14.625 75.896 14.945C75.636 15.265 75.506 15.74 75.506 16.37V20.3H73.526V16.46C73.526 15.95 73.471 15.555 73.361 15.275C73.261 14.995 73.111 14.795 72.911 14.675C72.721 14.545 72.496 14.48 72.236 14.48C71.756 14.47 71.386 14.625 71.126 14.945C70.876 15.265 70.751 15.74 70.751 16.37V20.3H68.771ZM82.2557 20.4522C82.0324 20.4522 81.8395 20.371 81.6771 20.2086C81.5215 20.0462 81.4437 19.8534 81.4437 19.6301C81.4437 19.4136 81.5215 19.2241 81.6771 19.0617C81.8395 18.8993 82.0324 18.8181 82.2557 18.8181C82.479 18.8181 82.6684 18.8993 82.8241 19.0617C82.9865 19.2241 83.0677 19.4136 83.0677 19.6301C83.0677 19.8534 82.9865 20.0462 82.8241 20.2086C82.6684 20.371 82.479 20.4522 82.2557 20.4522ZM86.5394 20.4218C86.0116 20.4218 85.5414 20.3101 85.1286 20.0868C84.7158 19.8568 84.3944 19.5421 84.1643 19.1429C83.9343 18.7369 83.8192 18.2768 83.8192 17.7625C83.8192 17.2415 83.9343 16.7813 84.1643 16.3821C84.3944 15.9829 84.7124 15.6716 85.1184 15.4483C85.5244 15.2182 85.9913 15.1032 86.5191 15.1032C87.0266 15.1032 87.4902 15.2284 87.9097 15.4787C88.3292 15.7291 88.6337 16.0911 88.8232 16.5648L87.5646 17.0114C87.4699 16.8152 87.321 16.6595 87.118 16.5445C86.9218 16.4227 86.7018 16.3618 86.4582 16.3618C86.2079 16.3618 85.988 16.4227 85.7985 16.5445C85.609 16.6595 85.4602 16.8219 85.3519 17.0317C85.2436 17.2415 85.1895 17.4851 85.1895 17.7625C85.1895 18.0399 85.2436 18.2835 85.3519 18.4933C85.4602 18.6963 85.6124 18.8587 85.8086 18.9805C86.0049 19.1023 86.2282 19.1632 86.4785 19.1632C86.7221 19.1632 86.9421 19.0989 87.1383 18.9703C87.3413 18.8418 87.4902 18.6726 87.5849 18.4628L88.8536 18.9094C88.6574 19.3899 88.3495 19.762 87.93 20.0259C87.5172 20.2898 87.0537 20.4218 86.5394 20.4218ZM92.0803 20.4218C91.5525 20.4218 91.0822 20.3101 90.6695 20.0868C90.2567 19.8568 89.9353 19.5421 89.7052 19.1429C89.4752 18.7369 89.3601 18.2768 89.3601 17.7625C89.3601 17.2415 89.4752 16.7813 89.7052 16.3821C89.9353 15.9829 90.2533 15.6716 90.6593 15.4483C91.0653 15.2182 91.5322 15.1032 92.06 15.1032C92.5675 15.1032 93.031 15.2284 93.4506 15.4787C93.8701 15.7291 94.1746 16.0911 94.3641 16.5648L93.1055 17.0114C93.0107 16.8152 92.8619 16.6595 92.6589 16.5445C92.4626 16.4227 92.2427 16.3618 91.9991 16.3618C91.7488 16.3618 91.5288 16.4227 91.3394 16.5445C91.1499 16.6595 91.001 16.8219 90.8928 17.0317C90.7845 17.2415 90.7304 17.4851 90.7304 17.7625C90.7304 18.0399 90.7845 18.2835 90.8928 18.4933C91.001 18.6963 91.1533 18.8587 91.3495 18.9805C91.5458 19.1023 91.7691 19.1632 92.0194 19.1632C92.263 19.1632 92.4829 19.0989 92.6792 18.9703C92.8822 18.8418 93.031 18.6726 93.1258 18.4628L94.3945 18.9094C94.1983 19.3899 93.8904 19.762 93.4709 20.0259C93.0581 20.2898 92.5946 20.4218 92.0803 20.4218Z"
        fill="currentColor" />
    </g>
  </g>
</svg>