Use different resourcePackage for resources
nikartx opened this issue · comments
Hi! Thanks for cool library
I need to have different resourcePackage for resources, for example to use common fonts from core module. What I mean:
# [optional] Android export parameters
android:
# Relative or absolute path to the `main/res` folder including it. The colors/icons/images will be exported to this folder
mainRes: "../../../someTheme/src/main/res"
# [optional] The package name, where the android resource constant `R` is located. Must be provided to enable code generation for Jetpack Compose
resourcePackage: "com.github.nikartm.someTheme"
# [optional] Relative or absolute path to the code source folder including it. The typography for Jetpack Compose will be exported to this folder
mainSrc: "../../../someTheme/src/main/java"
# [optional] Path to the Stencil templates used to generate code
templatesPath: "../Resources/Templates"
# Parameters for exporting colors
colors:
# [optional] The package to export the Jetpack Compose color code to. Note: To export Jetpack Compose code, also `mainSrc` and `resourcePackage` above must be set
composePackageName: "com.github.nikartm.someTheme.compose.theme"
# Parameters for exporting icons
icons:
# Where to place icons relative to `mainRes`? FigmaExport clears this directory every time your execute `figma-export icons` command
output: "figma-export-icons"
# Parameters for exporting images
images:
# Where to place images relative to `mainRes`? FigmaExport clears this directory every time your execute `figma-export images` command
output: "figma-export-images"
# Image file format: svg, png or webp
format: webp
# Format options for webp format only
webpOptions:
# Encoding type: lossy or lossless
encoding: lossy
# Encoding quality in percents. Only for lossy encoding.
quality: 90
# Parameters for exporting typography
typography:
# FOR EXAMPLE
resourcePackage: "com.github.nikartm.core"
# Typography name style: camelCase or snake_case
nameStyle: camelCase
# [optional] The package to export the Jetpack Compose typography code to. Note: To export Jetpack Compose code, also `mainSrc` and `resourcePackage` above must be set
composePackageName: "com.github.nikartm.someTheme.compose.theme"
See part
# Parameters for exporting typography
typography:
# FOR EXAMPLE
resourcePackage: "com.github.nikartm.core"
# Typography name style: camelCase or snake_case
nameStyle: camelCase
# [optional] The package to export the Jetpack Compose typography code to. Note: To export Jetpack Compose code, also `mainSrc` and `resourcePackage` above must be set
composePackageName: "com.github.nikartm.someTheme.compose.theme"
Here core and someTheme is a different modules. And core contains fonts reused in the someTheme. As well as core contains base theme and its own figma-export.yaml
. In this case my compose Typography will be broken, because the imports in someTheme.compose.theme.Typography.kt will be wrong.
I can't copy fonts in the someTheme resources because its will be duplicate resource problem.
It seems that custom resourcePackage can sometimes be useful for colors too.