Hi folks! I have released version 2.0.0 of <svg-t...
# feed
r
Hi folks! I have released version 2.0.0 of svg-to-compose, introducing a Gradle Plugin for parsing and code generation for your icons. For those who don't know, svg-to-compose is a native CLI tool, 100% written using KMP, that parses and creates an
ImageVector
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:
Copy code
plugins {
    id("dev.tonholo.s2c") version "2.0.0"
}
2. Configure the plugin using its extension, with its required configuration:
Copy code
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 😁
🔥 4