Rafael Tonholo
11/30/2024, 12:41 AMImageVector
for your SVG or XML. With the introduction of the Gradle Plugin, the CLI also becomes a library, targeting macOS, linux, mingwX64, and JVM.
Additionally, version 2.0.0 features some new capabilities for the CLI, which are all available in the plugin:
- Exclude specified files that match a regex by using the —exclude "regex"
option.
- Rename the icon's name by using the option --rename "matching_name" "replacing_name"
.
- Enable preview generation for KMP projects using the —kmp
flag.
To use the Gradle Plugin, you just need to:
1. Apply the plugin to your Android or KMP project:
plugins {
id("dev.tonholo.s2c") version "2.0.0"
}
2. Configure the plugin using its extension, with its required configuration:
svgToCompose {
processor {
val icons by creating {
from(layout.projectDirectory.dir("src/main/resources/icons"))
destinationPackage("com.example.app.ui.icons")
icons {
theme("com.example.app.ui.theme.AppTheme")
}
}
}
}
The Gradle plugin supports multiple processor configurations and features a common configuration option if needed. Additionally, more customizations can be configured! Features like optimization (through svgo or avocado), recursive search on child folders, etc.
Please check the documentation for more information.
If you have any questions or if you spot any issues, please let me know, and I would be glad to help 😁