svgsym: A tool to prune unused symbols from icon SVG files.

[ gpl, program, utility ] [ Propose Tags ]

This is a simple tool to prune unused symbols from icon SVG files. Specifically, this tools takes as input - an SVG file that consists only of symbol elements, - one of more glob patterns of source files, and - a regular expression that identifies symbol references. It then scans your source files for references to symbols in the SVG file. The output of the tool is an SVG file that contains only the symbols referenced in your source files.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.2.0
Change log CHANGELOG.md
Dependencies array (>=0.5 && <0.6), base (>=4 && <5), bytestring (>=0.10 && <0.13), containers (>=0.6 && <0.7), directory (>=1.3 && <1.4), filepath (>=1.4 && <1.5), filepattern (>=0.1.2 && <0.2), optparse-applicative (>=0.16 && <0.19), regex-base (>=0.94 && <0.95), regex-tdfa (>=1.3.1 && <1.4), xml (>=1.3 && <1.4) [details]
License GPL-3.0-or-later
Copyright © 2022–2024 Robert Helgesson
Author Robert Helgesson
Maintainer robert@rycee.net
Category Utility
Home page https://git.sr.ht/~rycee/svgsym
Bug tracker https://lists.sr.ht/~rycee/public-inbox
Source repo head: git clone https://git.sr.ht/~rycee/svgsym
Uploaded by RobertHelgesson at 2024-02-19T22:08:12Z
Distributions
Executables svgsym
Downloads 138 total (12 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2024-02-19 [all 1 reports]

Readme for svgsym-0.1.2.0

[back to package description]

svgsym

This is a simple tool to prune unused symbols from icon SVG files.

Specifically, this tools takes as input

  • an SVG file that consists only of symbol elements,

  • one of more glob patterns of source files, and

  • a regular expression that identifies symbol references.

It then scans your source files for references to symbols in the SVG file. The output of the tool is an SVG file that contains only the symbols referenced in your source files.

Example

We can prune the all.svg file from css.gg project for a Haskell project by running the below command. Note that the symbol regular expression consist of a single capture group that captures the actual symbol identifier.

$ svgsym css-gg/all.svg \
    --content './src/**/*.hs' \
    --symbol '"(gg-[a-z]+)"' \
    > ./output/static/css-gg.svg

Bug Reports and Sending Patches

Bug reports and patches are managed through my sourcehut public inbox.

Development

The intended development flow is to use a Nix Flake development shell, e.g., using Direnv or directly running

$ nix develop .
…

This will help set up a shell containing the necessary development dependencies. This shell will also be populated with utilities that can be run directly in the terminal:

  • p-format – formats the project's Cabal, Haskell, and Nix code.

License

GNU General Public License v3.0 or later