0 purchases
svg optimizer
SVG Optimizer #
A Dart package that optimizes SVG files at build time using SVGO.
Developed with 💛 by Droids On Roids ⚡
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.
Install SVGO
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
copied to clipboard
or run this command:
flutter pub add svg_optimizer
copied to clipboard
Example usage #
assets:
- path: assets/svg/
transformers:
- package: svg_optimizer
copied to clipboard
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']
copied to clipboard
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.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.