svg-slim icon indicating copy to clipboard operation
svg-slim copied to clipboard

[archive] config based on current defaults

Open tobwen opened this issue 4 years ago • 5 comments

I've just created a config based on the current defaults (https://github.com/benboba/svg-slimming/commit/3e81e7a6106357ac2e2cd7072b9c5b8f49256555). This might help others with playing with the settings - at least it helped my.

{
    "collapse-g": [ true ],
    "collapse-textwrap": [ true ],
    "combine-path": [ true, {
            "disregardFill": false,
            "disregardOpacity": false
        }
    ],
    "combine-transform": [ true, {
            "angelDigit": 2,
            "sizeDigit": 2,
            "trifuncDigit": 3
        }
    ],
    "compute-path": [ true, {
            "angelDigit": 2,
            "sizeDigit": 2,
            "straighten": 0,
            "thinning": 0
        }
    ],
    "rm-attribute": [ true, {
            "keepAria": false,
            "keepEvent": false,
            "rmDefault": true
        }
    ],
    "rm-comments": [ true ],
    "rm-doctype": [ true ],
    "rm-hidden": [ true ],
    "rm-irregular-nesting": [ true, {
            "ignore": []
        }
    ],
    "rm-irregular-tag": [ true, {
            "ignore": []
        }
    ],
    "rm-px": [ true ],
    "rm-unnecessary": [ true, {
            "tags": [
                "desc",
                "discard",
                "foreignObject",
                "video",
                "audio",
                "iframe",
                "canvas",
                "metadata",
                "script",
                "title",
                "unknown",
                "image"
            ]
        }
    ],
    "rm-version": [ true ],
    "rm-viewbox": [ true ],
    "rm-xml-decl": [ true ],
    "rm-xmlns": [ true ],
    "shorten-animate": [ true, {
            "remove": false
        }
    ],
    "shorten-class": [ true ],
    "shorten-color": [ true, {
            "opacityDigit": 3,
            "rrggbbaa": false
        }
    ],
    "shorten-decimal-digits": [ true, {
            "angelDigit": 2,
            "sizeDigit": 2
        }
    ],
    "shorten-defs": [ true ],
    "shorten-filter": [ true ],
    "shorten-id": [ true ],
    "shorten-shape": [ true, {
            "thinning": 0
        }
    ],
    "shorten-style-attr": [ true, {
            "exchange": false,
            "rmDefault": true
        }
    ],
    "shorten-style-tag": [ true, {
            "deepShorten": true,
            "rmDefault": true
        }
    ]
}

tobwen avatar Sep 27 '20 21:09 tobwen

Hello, I am working on the development of version 2.0.0. There will be some changes to the config of this version. You can see these changes in the develop branch.

2.0.0 will split config into rules and params, some common settings will be merged into params, and browserlist will be introduced to adapt to different environments (for the time being, only geometry properties are involved).

benboba avatar Sep 28 '20 08:09 benboba

Could you provide a new "default ruleset" for this (or maybe I can build one again)? It allows easy access to the processing of the numerous parameters. I love your readme, but sometimes tweaking the rules is easier, when the defaults are known.

tobwen avatar Sep 28 '20 12:09 tobwen

hint

You have forgotten "deepShorten": boolean as a configuration of shorten-style-tag in the documentation.

That seems to be the current default set.

{
    "rules": {
        "collapse-g": true,
        "collapse-textwrap": true,
        "combine-path": [ false, {
                "disregardFill": false,
                "disregardOpacity": false
            }
        ],
        "combine-transform": true,
        "compute-path": true,
        "rm-attribute": [ true, {
                "keepAria": false,
                "keepEvent": false
            }
        ],
        "rm-comments": true,
        "rm-doctype": true,
        "rm-hidden": true,
        "rm-irregular-nesting": [ true, {
                "ignore": []
            }
        ],
        "rm-irregular-tag": [ true, {
                "ignore": []
            }
        ],
        "rm-px": true,
        "rm-unnecessary": [ true, {
                "tags": [
                    "desc",
                    "discard",
                    "foreignObject",
                    "video",
                    "audio",
                    "iframe",
                    "canvas",
                    "metadata",
                    "script",
                    "title",
                    "unknown",
                    "image"
                ]
            }
        ],
        "rm-version": true,
        "rm-viewbox": true,
        "rm-xml-decl": true,
        "rm-xmlns": true,
        "shorten-animate": [ true, {
                "remove": false
            }
        ],
        "shorten-class": true,
        "shorten-color": [ true, {
                "rrggbbaa": false
            }
        ],
        "shorten-decimal-digits": true,
        "shorten-defs": true,
        "shorten-filter": true,
        "shorten-id": true,
        "shorten-shape": true,
        "shorten-style-attr": true,
        "shorten-style-tag": [ true, {
                "deepShorten": true
            }
        ],
    },
    "params": {
        "sizeDigit": 2,
        "angelDigit": 2,
        "trifuncDigit": 3,
        "opacityDigit": 3,
        "thinning": 0,
        "straighten": 0,
        "mergePoint": 0,
        "rmAttrEqDefault": true,
        "exchangeStyle": false
    },
    "browsers": ["defaults"]
}

tobwen avatar Sep 28 '20 14:09 tobwen

Thanks for correcting me, I have updated the document

benboba avatar Oct 09 '20 04:10 benboba

Now that 2.0.1 has been released, the default configuration of the new optimization rules is as follows:

{
    "rules": {
        "apply-style": true,
        "collapse-g": true,
        "collapse-textwrap": true,
        "combine-path": [ false, {
                "disregardFill": false,
                "disregardOpacity": false
            }
        ],
        "combine-transform": true,
        "compute-path": true,
        "rm-attribute": [ true, {
                "keepAria": false,
                "keepEvent": false
            }
        ],
        "rm-comments": true,
        "rm-doctype": true,
        "rm-hidden": true,
        "rm-important": true,
        "rm-illegal-style": true,
        "rm-irregular-nesting": [ true, {
                "ignore": []
            }
        ],
        "rm-irregular-tag": [ true, {
                "ignore": []
            }
        ],
        "rm-px": true,
        "rm-unnecessary": [ true, {
                "tags": [
                    "desc",
                    "discard",
                    "foreignObject",
                    "video",
                    "audio",
                    "iframe",
                    "canvas",
                    "metadata",
                    "script",
                    "title",
                    "unknown",
                    "image"
                ]
            }
        ],
        "rm-version": true,
        "rm-viewbox": true,
        "rm-xml-decl": true,
        "rm-xmlns": true,
        "shorten-animate": [ true, {
                "remove": false
            }
        ],
        "shorten-class": true,
        "shorten-color": [ true, {
                "rrggbbaa": false
            }
        ],
        "shorten-decimal-digits": true,
        "shorten-defs": true,
        "shorten-filter": true,
        "shorten-id": true,
        "shorten-shape": true,
        "shorten-style-attr": true,
        "shorten-style-tag": true,
        "style-to-class": true
    },
    "params": {
        "sizeDigit": 2,
        "angelDigit": 2,
        "trifuncDigit": 3,
        "opacityDigit": 3,
        "thinning": 0,
        "straighten": 0,
        "mergePoint": 0,
        "rmAttrEqDefault": true,
        "exchangeStyle": false,
        "ignoreKnownCSS": false
    },
    "browsers": ["defaults"]
}

benboba avatar Nov 02 '20 10:11 benboba