Skip to content
Noah Baldwin edited this page Feb 21, 2025 · 2 revisions

Welcome to the oxvg wiki!

Thanks for using oxvg, to install please follow the instructions from the latest release. For use as a library, please refer to their respective docs.

Usage

For basic instruction on using oxvg, please run the following

$ # Your run of `oxvg --help` may be more up to date
$ oxvg --help
Your versatile vector-graphics toolchain

Usage: oxvg <COMMAND>

Commands:
  optimise  Optimise SVG documents
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

For instructions on a subcommand, provide the same --help flag to the given command

Optimisation

Using oxvg as a binary may be slightly different to what you're used to. In an effort to be safer and simpler to use oxvg by default works under the following contraint.

  • Do one thing well (i.e. the Unix Philosophy)
  • Dry-run by default (i.e. do nothing by default)

So the best way to run it is as follows

cat my-file.svg | oxvg optimise > my-file.optimised.svg

In this way, oxvg only does one thing (optimises the file) without doing anything (reading/writing is handled by cat and >)

Luckily, we do provide some shortcuts to get around this default behaviour, so that it can take the burden of complexity in reading and writing files.

# Read and optimise file to stdout
oxvg optimise my-file.svg

# Read and optimise many files to stdout
oxvg optimise svgs/

# Read and optimise many files and directories to stdout
oxvg optimise svgs/ -r

# Read and optimise many files and directories back to input files
oxvg optimise svgs/ -r -o

# Read and optimise many files and directories to a new location
oxvg optimise svgs/ -r -o output/

# Read and optimise many files and directories to a new location, including hidden files
oxvg optimise svgs/ -r -o output/ -.

Configuration

oxvg can also be configured by using an oxvgrc.json file. To output your current config (or default) you can run the following.

# TODO: oxvg config
oxvg optimise --config

oxvg will use oxvgrc.json as long as the current-working-directory is in -- or a descendant of -- the oxvgrc's directory.

Clone this wiki locally