1
0
mirror of https://github.com/svg/svgo.git synced 2026-01-27 07:02:06 +03:00
Commit Graph

464 Commits

Author SHA1 Message Date
Seth Falco
52961ba28c ci: dont create diff png if no_diff (#1903) 2023-12-25 14:06:44 +00:00
Jon Dufresne
db78c4b7b5 chore: Remove unused argument "input" in calls to optmize() (#1901) 2023-12-24 23:11:22 +00:00
Kendell R
a7859eb177 fix(convertPathData): fix some weird behavior (#1867) 2023-12-24 01:47:29 +00:00
Seth Falco
2c408ce56f refactor: improve regression testing (#1898) 2023-12-23 06:56:46 +00:00
Kendell R
16c6977215 chore: speedier regression testing (#1897) 2023-12-23 03:21:14 +00:00
Seth Falco
22533f1ffe chore: update prettier and eslint (#1885) 2023-12-15 13:10:21 +00:00
Seth Falco
c172c9e6d6 fix(cleanupIds): handle uri encoded references (#1880) 2023-12-10 00:31:55 +00:00
john-neptune
6a814cd2e7 fix(prefixIds): update all nodes in style tags (#1736) 2023-12-09 23:04:45 +00:00
Kendell R
2d9e101ded fix(removeHiddenElems): handle defs better (#1879) 2023-12-09 22:25:30 +00:00
Seth Falco
8390add9ab feat(removeUnknownAndDefaults): apply to xml declarations (#1872) 2023-12-07 11:56:14 +00:00
Jon Dufresne
d6ff70baf9 chore: fix several typos (#1868) 2023-12-03 18:02:22 +00:00
Seth Falco
a663d8d683 fix(cleanupEnableBackground): clean up inline styles too (#1866) 2023-12-02 12:26:21 +00:00
Seth Falco
39e855be9e fix(inlineStyles): refactor how styles are collected (#1865) 2023-12-01 16:45:09 +00:00
Kendell R
51449360f5 fix(cleanupIds): properly handle begin regex to fix #1775 (#1862) 2023-11-30 14:38:27 +00:00
Vincent Bernat
f0ec586991 fix(removeEmptyContainers): don't remove empty containers if parent is switch (#1747) 2023-11-29 01:03:49 +00:00
Kendell R
8dd7a3b2fc fix(convertPathData): handle setting prev properly to fix path joining and #1855 (#1856) 2023-11-29 00:39:08 +00:00
Kendell R
86d5040382 fix(convertPathData): account for error in z conversions (#1842) 2023-11-28 02:01:20 +00:00
Seth Falco
e22d533be8 fix(removeHiddenElems): remove hidden definitions usage (#1852) 2023-11-26 20:55:35 +00:00
Bogdan Chadkin
9fca7be551 feat(removeXlink): new plugin to map xlink attrs to svg 2 2023-11-18 16:29:20 +00:00
Seth Falco
7d481acfea test: enable regression test that now passes (#1833) 2023-11-13 15:12:40 +00:00
Seth Falco
b740c07695 fix(inlineStyles): dont remove wrapper class if traversed (#1832) 2023-11-13 14:53:30 +00:00
Seth Falco
7e25b62fa7 fix(inlineStyles): inline styles in order of priority (#1831) 2023-11-12 18:11:46 +00:00
Kendell R
14bdacc2df feat(convertPathData): replace with z and remove z when optimal (#1822) 2023-11-12 13:52:01 +00:00
Seth Falco
a9df915d1d fix: dont trim pre elements (#1796)
Includes pre in the array of text elements in _collections.js so that we don't trim whitespace on them, which effects rendering.
2023-11-12 11:56:39 +00:00
Seth Falco
4c2cc1bbdb feat(inlineStyles): remove redundant presentation attrs (#1829)
SVGs can have the same presentation attribute declared redundantly in
both the node attributes and `<style>` tag.

This wouldn't break anything, but we can shave off a few more bytes by
dropping the attribute in this case.
2023-11-11 12:43:13 +00:00
Seth Falco
96fedb4855 chore: change link to homepage in package.json (#1824)
Change the link of the homepage from this Git repository (which is
already documented in `bugs` and `repository` to a link to the
documentation.
2023-11-08 16:00:36 +00:00
Seth Falco
5aad38bcc7 fix(inlineStyles): empty css block created empty attribute (#1823)
When running this plugin on an SVG with an empty block in the CSS, it
would apply it to the matched elements by adding an empty `style`
attribute. See the test for an example.

This resolves that by just dropping the declaration if it's empty.
2023-11-07 23:20:48 +00:00
Seth Falco
07c09199ed fix: remove hrefs for unconventional namespaces (#1820) 2023-11-04 15:17:15 +00:00
Seth Falco
e73ee2de96 fix(removeScriptElement): collapse a tag propertly (#1818) 2023-11-04 13:42:07 +00:00
Seth Falco
1df2e0fa39 fix(cleanupIds): skip generated ids for malformed references (#1817)
I also had some chores pending which were trivial individually, I opted
to incorporate them here as well.

* In JSDocs, use the nullable syntax as it's more concise and familiar
from TypeScript usage.
* discord → Discord (proper nouns should match capitalization)
* Use actions/checkout v4 instead of v2
2023-11-04 12:56:20 +00:00
Seth Falco
a880505859 fix(removeScriptElement): remove link anchors with scripts (#1807) 2023-10-29 14:46:55 +00:00
Seth Falco
7de793c54a fix(removeComments): make preserving comments a param (#1812)
Converts the hard-coded exception to a param so users can override this
behavior to preserve custom patterns or drop the logic altogether.
2023-10-27 18:03:50 +01:00
Seth Falco
6eac770ba5 feat: convert one stop gradients plugin (#1790)
Detects if a redundant linearGradient or radialGradient is used with
only a single stop, which effectively means a solid color.

If this is found, just remove the gradient and replace references to it
with the color of the first and only stop defined.
2023-10-22 13:53:39 +01:00
Seth Falco
02c7a78536 fix(convertTransform): do not add redundant space between functions (#1802)
The space is optional between transform functions in the `transform`
attribute and similar properties. This just omits the space as a
micro-optimization.

This does not add new tests is the scenario is covered adequately in
existing tests.

Also refactors js2transform to avoid concatenating in a loop.
2023-09-27 17:20:10 +01:00
Seth Falco
2539b9f4c6 fix(inlineStyles): remove all classes in multiclass selector (#1801)
When running into a multi-class selector with `inlineStyles`, it would
only remove the first class of the selector instead of all of them.

This iterates the classes in the selector instead of only taking the
first. Also performs some minor refactors.
2023-09-27 17:19:46 +01:00
Seth Falco
b15da27af4 fix(minifyStyles): pass empty arrays for usage (#1800) 2023-09-25 23:13:54 +01:00
Seth Falco
7e99c0bd49 fix(inlineStyles): case insensitive style props (#1797)
Style property names are case-insensitive, for example `fill`, `FILL`,
and `FiLl` are all valid but refer to the same property. So when
inlining styles, we compare the lowercase strings and only use the last
instance of the property rather than embed them all.
2023-09-25 19:05:11 +01:00
Seth Falco
42f7752db1 fix(cleanupIds): handle when 2 ids referenced in one attr (#1795) 2023-09-25 19:04:31 +01:00
Seth Falco
f07e9de089 fix: resolve regression test for removeHiddenElems (#1793) 2023-09-25 19:04:06 +01:00
Seth Falco
078a09c19a fix(reusePaths): pass test-regression task (#1791)
Signed-off-by: Seth Falco <seth@falco.fun>
2023-09-25 19:03:42 +01:00
Seth Falco
bd750ceebb fix(reusePaths): dont reuse id if referenced in href (#1784)
Fixes a bug where the reusePaths plugin would reuse the node ID that
it's optimizing, but that ID was also referenced in a href elsewhere
in the document, so it unintentionally applied the path to other nodes.
2023-09-23 21:47:04 +01:00
Seth Falco
5f40d8bce4 fix(reusePaths): reuse defs tag if exists and remove redundant nodes (#1785) 2023-09-23 21:37:04 +01:00
Seth Falco
9f7894d7e9 test: add check for keyframe selector to (#1783)
Adds test for issue reported regarding keyframe selectors.
2023-09-23 16:57:42 +01:00
Seth Falco
59ab80eed2 test: fix regression testing action (#1788)
The regression-test GitHub Action was failing for all pull requests due
to not handling the gzipped archive properly.

This resolved it by piping the response body to zlib#createGunzip
first. Also updates the relevant dependencies.

Signed-off-by: Seth Falco <seth@falco.fun>
Co-authored-by: strarsis <strarsis@gmail.com>
Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
2023-09-23 07:47:30 +01:00
Andrew
dd70f34b67 fix: begin's attribute incorrectly modification (#1658)
Co-authored-by: Andrey Nelyubin <nelyubin_a_a@sunlight.net>
2022-11-11 12:57:15 +03:00
Bogdan Chadkin
6295c60fbf Rename cleanupIDs to cleanupIds for consistency with prefixIds 2022-10-23 11:54:48 +03:00
Bogdan Chadkin
420ae9d8a1 Throw SvgoParserError 2022-10-10 00:33:19 +03:00
Bogdan Chadkin
dd9cad1cf9 Add sortAttrs to default preset 2022-10-09 17:29:11 +03:00
Bogdan Chadkin
f649eabf6d Remove active flag in plugin config 2022-10-08 19:42:29 +03:00
Bogdan Chadkin
12272958db Upgrade csso and csstree 2022-10-08 14:57:57 +03:00