1
0
mirror of https://github.com/svg/svgo.git synced 2025-08-07 15:22:54 +03:00
Commit Graph

1243 Commits

Author SHA1 Message Date
Bogdan Chadkin
9263d9ab90 Fix svg spec urls in plugins 2021-02-24 11:18:48 +03:00
Bogdan Chadkin
355fb1ff24 2.1.0 v2.1.0 2021-02-24 01:44:44 +03:00
Bogdan Chadkin
9de471a0f4 Handle nested textual tags
This bug was also catched by regression tests. Single state was
overriden in opentag/closetag callbacks. Using stack state solved the
problem with nested textual tags.

Now many whitespaces bugs should go away.
2021-02-24 00:58:11 +03:00
Bogdan Chadkin
4b4259bc60 Fix parsing xml entities (#1371)
Ref https://github.com/svg/sax/releases/tag/v0.1.1

This fixes enother case in [regression tests](https://github.com/svg/svgo/pull/1357).
2021-02-23 22:49:28 +03:00
Bogdan Chadkin
c1d5f0f7a9 Keep empty <g> when filter attributes is specified 2021-02-23 22:36:47 +03:00
Bogdan Chadkin
776ec1e71b Fix incorrect xml:space default 2021-02-23 18:43:28 +03:00
Max Goodhart
9f084cc086 Preserve whitespace in elements containing text (#1220) 2021-02-23 18:25:30 +03:00
Bogdan Chadkin
0021144d4e Fork sax (#1369)
There was a lot of PR with switching to another xml parser because sax
is not maintained for almost 4 years already.

Though switching parser to solve a few problems may introduce many new
bugs. This is why we decided to fork sax and maintain own version.

For initial release I removed node streams support which allows to get
rid from some magic in browser bundle build config and got rid from
String.fromCodePoint polyfill.

Forked package is here https://github.com/svg/sax
2021-02-23 16:44:35 +03:00
Chris Hayes
797a8e843d Fix npm install script typo (#1368) 2021-02-23 01:52:51 +03:00
Bogdan Chadkin
a1fcd034fe Disable convertStyleToAttrs plugin by default (#1365)
Ref https://github.com/svg/svgo/issues/1362 https://github.com/svg/svgo/issues/1360

From the [spec](https://www.w3.org/TR/SVG11/styling.html#UsingPresentationAttributes):

> Presentation attributes have lower priority than other CSS style rules specified in author style sheets or ‘style’ attributes.

Though we replace inline styles with attributes without checking if
thare is any `<style>` element. This makes the plugin unsafe and it
should not be enabled by default.
2021-02-23 00:28:09 +03:00
Bogdan Chadkin
a855b40ec5 Fail when specified config is wrong or json is specified 2021-02-22 23:50:42 +03:00
Sebastian Kreft
aa8e0bd3f6 Add Github Issue Templates (#1367)
* Path intersection was not checking paths with circles.

As an optimization the path intersection was checking the paths had three or more elements, caliming that otherwise there was nothing to fill. However a semi circle would actually contain 2 points.

Fixes #1048.

This adds a simplified test case for the 2 offending files reported in the issue.

* Add issue templates

We add issue templates for:

- Bug Reports
- Feature Requests
- Plugin Requests
- Pull Requests
- Questions

* Add Github issue templates

Fixes #1364, but is is missing the template for pull requests see
https://docs.github.com/en/github/building-a-strong-community/creating-a-pull-request-template-for-your-repository

* fix

* Use "New plugin" label

Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
2021-02-22 23:35:14 +03:00
Bogdan Chadkin
9b97e06ef6 Fix empty <svg /> in cleanupIDs plugin 2021-02-21 14:50:55 +03:00
XhmikosR
727646e6a7 convertTransform: remove unused assignment (#1354) 2021-02-20 22:31:56 +03:00
Bogdan Chadkin
4ad91f2323 2.0.3 v2.0.3 2021-02-20 19:06:22 +03:00
Bogdan Chadkin
c1edce4d2d Fix error message in addAttributesToSVGElement plugin
Ref https://github.com/svg/svgo/issues/1352
2021-02-20 19:04:46 +03:00
一丝
8d7cfa02c7 After ‘arcto’ path command(a or A) flags, spaces are no longer removed by default (#1353)
Co-authored-by: 壹丝 <jie.lijie@alibaba-inc.com>
2021-02-20 18:58:42 +03:00
XhmikosR
26f5e323dd Switch to c8 for coverage (#1350) 2021-02-20 18:37:08 +03:00
XhmikosR
6c0f8c5efb reusePaths: fix redundant variable assignment (#1349) 2021-02-20 17:31:34 +03:00
XhmikosR
df14f37c48 test/coa/_index.js: Fix regex (#1347)
`.` means any character but we want to match the literal `.`
2021-02-20 17:05:04 +03:00
XhmikosR
1b2c2625e3 CI: specify FORCE_COLOR: 2 (#1351) 2021-02-20 17:03:42 +03:00
Bogdan Chadkin
d9f68d3be0 [removeElementsByAttr] fix removing elements when class is empty
Ref https://github.com/svg/svgo/issues/937

Regexp didn't not cover the case when class list is empty.
2021-02-20 16:54:46 +03:00
Bogdan Chadkin
4490d62ee9 Add mask-type to the list of <mask> attributes
Ref https://github.com/svg/svgo/issues/1254
2021-02-20 13:59:21 +03:00
Bogdan Chadkin
7f4e05297a [convertEllipseToCircle] fix ellipse without radius
Ref https://github.com/svg/svgo/issues/1264
2021-02-20 12:50:36 +03:00
Bogdan Chadkin
ea82cc2880 Report parsing errors with filename 2021-02-20 00:59:54 +03:00
Christian Ruigrok
b9880491b5 [reusePaths] fix excessive defs tag (#1201) 2021-02-19 23:56:20 +03:00
Bogdan Chadkin
82778c872d Reduce browser build size 1450kB -> 820kB 2021-02-19 15:34:37 +03:00
Bogdan Chadkin
a7cc20bb43 Setup recommended eslint preset (#1345)
This is usually enough to prevent silly mistakes.
Formatting will be done by prettier after merging pull requests.
2021-02-19 15:26:07 +03:00
Bogdan Chadkin
feefdc0b84 2.0.2 v2.0.2 2021-02-19 12:20:33 +03:00
Bogdan Chadkin
68e40caaea Add better docs (#1337)
Clarified configuration format, simplified CLI example, described
programming api.
2021-02-19 12:11:58 +03:00
Bogdan Chadkin
330e78b479 Fix reporting of config errors (#1342)
Errors are swallowed while resolving.
2021-02-19 12:11:35 +03:00
XhmikosR
400c867c5c Example: fix syntax error (#1340) 2021-02-19 02:32:20 +03:00
XhmikosR
293fa1eed6 Fix new Buffer usage (#1341) 2021-02-19 02:31:06 +03:00
XhmikosR
136a52cdb6 convertStyleToAttrs: fix wrong character class (#1338) 2021-02-19 02:30:05 +03:00
XhmikosR
264b2b564c CI: update to actions/setup-node@v2 (#1339) 2021-02-19 02:27:05 +03:00
Bogdan Chadkin
b65f6994b2 Simplify CLI usage 2021-02-18 22:04:14 +03:00
Bogdan Chadkin
ed65d170b3 Drop travis and coveralls badges 2021-02-18 21:30:26 +03:00
Bogdan Chadkin
9fb56d1494 v2.0.1 v2.0.1 2021-02-18 18:05:24 +03:00
Bogdan Chadkin
49d001a5ba Publish less 2021-02-18 17:57:02 +03:00
AlpayY
16cc8cf3a0 Added file detection for *.SVG files when working with folders (#1316)
Currently, files named *.SVG are not being detected under Windows because of the case-sensitivity. This commit includes these in addition to *.svg files.
2021-02-18 17:50:12 +03:00
Bogdan Chadkin
082aee027d Fix plugins order (#1334)
Ref https://github.com/svg/svgo/issues/1333

While refactoring broke plugin order.
2021-02-18 17:46:28 +03:00
Bogdan Chadkin
efa62c8e30 Fix multipass (#1332)
Ref https://github.com/svg/svgo/issues/1330 https://github.com/svg/svgo/issues/1148 https://github.com/svg/svgo/issues/1133 https://github.com/svg/svgo/pull/1227 https://github.com/svg/svgo/issues/985 https://github.com/svg/svgo/issues/943
Took tests from https://github.com/svg/svgo/pull/1177
2021-02-18 14:12:27 +03:00
LongYinan
0c85caa730 Fix 'ReferenceError: indent is not defined' (#1331) 2021-02-18 11:43:14 +03:00
Shogo Sensui
4b46caa619 Add editor plugins (#1113) 2021-02-18 00:14:21 +03:00
Eric Cornelissen
bb949a9894 Update README.md (#1243)
Add the SVGO Action as an "other way to use SVGO"
2021-02-17 23:57:50 +03:00
Sebastian Kreft
c9a3aea858 Path intersection was not checking paths with circles. (#1229)
As an optimization the path intersection was checking the paths had three or more elements, caliming that otherwise there was nothing to fill. However a semi circle would actually contain 2 points.

Fixes #1048.

This adds a simplified test case for the 2 offending files reported in the issue.
2021-02-17 23:50:08 +03:00
Bogdan Chadkin
814863bcd2 v2.0.0 v2.0.0 2021-02-17 19:57:13 +03:00
Bogdan Chadkin
9cfa98d03b Bump node to 10.13 2021-02-17 19:28:52 +03:00
Bogdan Chadkin
8cf52c0247 Replace npmignore with package.json files 2021-02-17 19:28:33 +03:00
Bogdan Chadkin
fbe82cd9c2 Upgrade commander 2021-02-16 19:52:50 +03:00