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

#799 in Web programming

Download history 124/week @ 2024-07-16 151/week @ 2024-07-23 20/week @ 2024-07-30 10/week @ 2024-09-10 4/week @ 2024-09-17 13/week @ 2024-09-24 278/week @ 2024-10-01 68/week @ 2024-10-08 3/week @ 2024-10-15

350 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

~3.5MB
~62K SLoC