Skip to content

Conversation

@depfu
Copy link
Contributor

@depfu depfu bot commented Sep 14, 2021

Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ svgo (^1.0.5 → ^2.6.0) · Repo · Changelog

Release Notes

2.6.0

We have some good stuff in this release

Better syntax errors (#1553)

Before people struggled to figure out what and why happens with such cryptic error

Error: Error in parsing SVG: Unquoted attribute value
Line: 1
Column: 29
Char: 6
File: input.svg

This gives too little information when a lot of svgs are transformed.

New errors look like this, include context and point to exact location with the issue.
We hope this will solve many issues when dealing with bundlers and other tools integrations.

Error: SvgoParserError: input.svg:2:29: Unquoted attribute value

1 | <svg viewBox="0 0 120 120">
> 2 | <circle fill="#ff0000" cx=60.444444" cy="60" r="50"/>
| ^
3 | </svg>
4 |

pefixIds plugin is now idempotent (#1561)

To get better compression results SVGO uses multipass option. This option is used
to run prefixIds plugin only once to prefix ids and classes properly.

Though sometimes users run svgo manually a few times which leads to duplicated
prefixes and make code much bigger. To solves this prefixIds was redesigned
to add prefix only when it does not exit in ids and classes.

Eventually all plugins are planned to be determenistic and idempotent
so multipass option would not be necessary and single pass compression
could be as effective as possible.

New js2svg options (#1546)

js2svg.eol: 'lf' | 'crlf'

Allows to customize end of line characters which is usually resolved by os.EOL in node.

finalNewline: boolean

Ensures SVG output has a final newline which is required for some tools like git.

Fixes and refactorings

Follwing plugins are migrated to the new visitor plugin api and covered with tsdoc

Also fixed a few bugs

  • add xmlns:xlink in reusePaths plugin when missing (#1555)
  • fixed removeNone param in removeUselessStrokeAndFill plugin (#1549)


If you enjoy SVGO and would like to support our work, consider sponsoring us directly via our OpenCollective.

Thanks to @XhmikosR, @matheus1lva, @deepsweet, @omgovich, @adalinesimonian and @TrySound

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by 16 commits:


Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

@depfu depfu bot added the depfu label Sep 14, 2021
@depfu depfu bot mentioned this pull request Sep 14, 2021
@depfu
Copy link
Contributor Author

depfu bot commented Sep 16, 2021

Closed in favor of #907.

@depfu depfu bot closed this Sep 16, 2021
@depfu depfu bot deleted the depfu/update/npm/svgo-2.6.0 branch September 16, 2021 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant