Skip to content

Latest commit

 

History

History
25 lines (22 loc) · 603 Bytes

collapse-g.md

File metadata and controls

25 lines (22 loc) · 603 Bytes

collapse-g

  • Default configuration:
{
	"rules": {
		"collapse-g": true
	}
}
  • Explanation:
    • When the g element has no children, remove the element
    • When the g element has no attribute value, replace the element with a child element
    • When the g element has only one child element and has no id, class, and mask attributes, copy the attributes of the g element to the child element and replace it with the child element

E.g:

<g></g>
<g fill="red"><rect width="100" height="100"/></g>

After optimization will become:

<rect fill="red" width="100" height="100"/>