5 releases

0.0.4 Oct 6, 2024
0.0.3 Oct 5, 2024
0.0.2 Oct 5, 2024
0.0.1 Jul 27, 2024
0.0.0 Jul 21, 2024

#798 in Web programming

Download history 127/week @ 2024-07-17 155/week @ 2024-07-24 13/week @ 2024-07-31 11/week @ 2024-09-11 6/week @ 2024-09-18 11/week @ 2024-09-25 287/week @ 2024-10-02 60/week @ 2024-10-09 1/week @ 2024-10-16

71 downloads per month

MIT/Apache

21KB
428 lines

SVGO Rust Logo

SvgOptimizer

SVG Optimizer for Rust & WebAssembly (WASM)

Early development notice

Motivation

Have a SVGO Rust implementation to optimize SVG files, which also exposes a WebAssembly (WASM) interface so its functionality can be used in the browser.

Features

The following list provides an overview of the features that are planned to be implemented as well as the ones that are already implemented.

Feel free to open an issue if you want to request a feature or if you want to contribute to the project by implementing any of these features.

Behavior

  • Multipass

Source Code

  • Prettify
  • Uglify

General

  • Clean up Attribute Whitespace
  • Clean IDs
  • Round/Rewrite Number Lists
  • Round/Rewrite Numbers
  • Collapse useless groups
  • Minify Colors
  • Round/Rewrite Paths
  • Shapes to (smaller) Paths
  • Style to Attributes
  • Round/Rewrite Transforms
  • Merge Paths
  • Move Attributes to Parent Group
  • Move Group Attributes to Elements
  • Prefer viewBox to width/height
  • Sort Attributes
  • Optimize single-path SVGs
  • Tidy Enable Background

Removes

  • Comments
  • <desc> tags
  • Doctype
  • Editor Data
  • Empty Attributes
  • Empty Containers
  • Empty Text
  • Hidden Elements
  • Metadata
  • Unneeded Group Attributes
  • Raster Images
  • <title>
  • unknowns and defaults
  • unused defs
  • unused namespaces
  • useless stroke and fill
  • viewBox
  • XML instructions
  • XMLNS Attribute
  • <style> elements

Inspiration

This project is inspired by the SVGO project available for Node.js ecosystem.

License

This project is licensed under the MIT license.

Dependencies

~2.6–3.5MB
~62K SLoC