Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use different resourcePackage for resources #211

Open
nikartx opened this issue Jun 20, 2023 · 0 comments
Open

Use different resourcePackage for resources #211

nikartx opened this issue Jun 20, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@nikartx
Copy link

nikartx commented Jun 20, 2023

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.

@subdan subdan added the enhancement New feature or request label Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants