svg_optimizer 0.0.1+1 copy "svg_optimizer: ^0.0.1+1" to clipboard
svg_optimizer: ^0.0.1+1 copied to clipboard

A Dart package that optimizes SVG files at build time using SVGO.

Flutter svg_optimizer Package

SVG Optimizer #

A Dart package that optimizes SVG files at build time using SVGO.

Developed with 💛 by Droids On Roids

Droids On Roids logo

Overview #

The goal of this package is to simplify the optimization of SVG files in Flutter projects using transformers.

Prerequisites #

Before package can be used, make sure to complete all of the prerequisites listed below.

  1. Install SVGO
  2. Make sure to add Node and SVGO to PATH environmental variable so that SVG Optimizer will be able to run them.

Usage #

Installation #

To use this plugin, add svg_optimizer as a dependency in your pubspec.yaml file.

dev_dependencies:
  svg_optimizer: ^0.0.1+1

or run this command:

flutter pub add svg_optimizer 

Example usage #

  assets:
    - path: assets/svg/
      transformers:
        - package: svg_optimizer

Running SVGO with custom configuration #

To run svg_optimizer with custom SVGO configuration, add a config key with path to svgo.config.mjs file to the transformer's args in the pubspec.yaml file.

  assets:
    - path: assets/svg/
      transformers:
        - package: svg_optimizer
          args: ['--config=path/to/svgo.config.mjs']

For more information on SVGO configuration and customizing the config, refer to the SVGO documentation.

Benchmark #

The package includes a benchmark utility to compare the size of the output file generated by flutter build with and without the svg_optimizer. To run the benchmark, use the command provided in the /benchmark directory documentation.

11
likes
160
pub points
45%
popularity
screenshot

Publisher

verified publisherthedroidsonroids.com

A Dart package that optimizes SVG files at build time using SVGO.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

args, collection, yaml_edit

More

Packages that depend on svg_optimizer