Skip to content

noahbald/oxvg

Repository files navigation

Oxidised Vector Graphics

release npm crate discord wiki

OXVG is an effort to create high-performance SVG tooling.

Bindings for node and wasm are available through NPM.

🎯 Tools

The following tools will be available in a CLI binary.

🪶 Optimiser

Tip

You can try out the OXVG optimiser right in your browser using OXVGUI, a simple web-based playground built by Jonas Geiler (@jonasgeiler).

An SVG optimiser similar to SVGO is available and runs multiple times faster on some tasks.

The optimiser is based on SVGO, but please be aware that this isn't an exact clone of SVGO and certain differences may be found. If you rely on stability, for the time being we recommend sticking to SVGO.

You can read more about these differences and why in this wiki page. Differences for any of the jobs are also documented with each struct/interface's declaration.

🤖 Actions (Under Development)

Tip

You can try out OXVG actions right in your browser using Vivec, an integration of actions into a Vi-like web-editor.

Actions are a set of commands that can be invoked by a program to manipulate an SVG document or pull information from it. It is comparable to InkScape's actions, but without any dependency on the UI or rendering.

🧹 Linter

A basic linter similar to svglint or vnu is available to make catching issues in SVG documents much easier. It's accessible as a printer or a language server.

image

📖 Libraries

If you're a Rust developer wanting to work with SVGs in your project, we have a set of crates at your disposal. As of now though, some are unstable and may be updated, merged, or moved as we see fit.

Actions (Unstable)

These are where the commands for our transformer will live and will contain a set of actions to manipulate SVGs.

This crate provides a set of types that can be used to implement a DOM similar to that of the browser web standards. Though it's not a 1-to-1 match; it's designed for easily traversing and manipulating the DOM.

There's currently an implementation that can be used with either the xml5ever or the roxmltree parser which can do the following.

  • Parse and serialize XML, SVG, and HTML documents
  • Commonly used browser API implementations for DOM nodes, elements, attributes, etc.
  • An implementation of selectors for using DOM CSS queries

This crate provides types and meta-types for SVG content.

  • Parsing attributes into structured data
  • Enumerators for known element, attributes, and namespaces

This is where the jobs (i.e. SVGO plugins) for our optimiser live and can also be used as a library for use in your applications.

Path (Unstable)

This is a library for parsing, optimising, and serialising path definitions (e.g. <path d="..." />).

Please expect some instability as we may add new features to enable simple manipulations for paths in the future.

Building

This project is currently in very early development and doesn't have any distributions yet. You can run the project for yourself by doing the following

git clone git@github.com:noahbald/oxvg.git
cd oxvg
cargo build --profile release --package oxvg
./target/release/oxvg.exe --help

Or you can install it through cargo

cargo install oxvg
oxvg --help

Contributing

You're welcome to help out and pick up a good first issue or email me to help.

Contributing and architecture guides are available as well.


Inspiration and Thanks

Thank you to the following projects for providing me inspiration to break into the tooling space.

  • oxc

Thank you to these high quality, open source projects on SVG tooling

  • SVGO
  • InkScape

Thank you to these dependents for helping make OXVG more popular

Licensing

OXVG is open-source and licensed under the MIT License

This project ports or copies code from other open-source projects, listed below

  • SVGO
  • oxc

About

Fastest SVG toolchain for optimisation, minification, linting, and actions. Usable via CLI, Node, Wasm, or Rust.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors