mapIconNameTo
Maps the original icon name to a custom name. Useful when the icon's filename contains recurring names.
E.g: A file named my_awesome_logo_filled.svg, without the mapIconNameTo() function would generated a ImageVector named MyAwesomeLogoFilled.
By applying the mapIconNameTo() function, as shown bellow:
svgToCompose.processor {
val filled by creating {
val themePackage = "my.awesome.app.theme"
from(rootProject.layout.projectDirectory.dir("assets/icons"))
destinationPackage("$themePackage.icons.filled")
optimize(false)
icons {
theme("$themePackage.MyAwesomeAppTheme")
mapIconNameTo { iconName ->
iconName.replace("_filled".toRegex(), "")
}
}
}
}Content copied to clipboard
Whenever a file inside the assets/icons folder contains _filled, the Filled won't be present in the generated ImageVector property's name. Thus, the same my_awesome_logo_filled.svg would generated an ImageVector named MyAwesomeLogo instead.
Parameters
mapper
A function that takes the original icon name and returns the custom name.