# cargo run --release -- --generate --config "assets/design_tokens_config.yaml" global: # Figma source paths # These are the pure files from Figma, they can contain aliases # For example if we have aliases we will need the actual value and not the alias # Separating different files is necessary in case there are duplicate trees but different values/aliases # So if we have button-md and button-big with the same trees but different values with aliases that need to be accesed from core.json # this should be the setup # Look at the figma/variables and figma/generated_styles for better understanding how it works figma_source_paths: - combine: file_name: "button-lg" files: - "assets/figma/variables/button-lg.json" - "assets/figma/variables/core-.json" - combine: file_name: "button-md" files: - "assets/figma/variables/button-md.json" - "assets/figma/variables/core-.json" - combine: file_name: "button-sm" files: - "assets/figma/variables/button-sm.json" - "assets/figma/variables/core-.json" - combine: file_name: "color-dark" files: - "assets/figma/variables/color-accent-primary.json" - "assets/figma/variables/color-accent-secondary.json" - "assets/figma/variables/color-status-success.json" - "assets/figma/variables/color-status-danger.json" - "assets/figma/variables/color-dark.json" - "assets/figma/variables/palette-.json" # file_name: If set this will be the name of the merged file # if not, than the first file name will be used figma_output_paths: - combine: file_name: "button-lg" merge: ["button-lg"] files: - path: "assets/figma/variables/button-lg.json" - combine: file_name: "button-md" merge: ["button-md"] files: - path: "assets/figma/variables/button-md.json" - combine: file_name: "button-sm" merge: ["button-sm"] files: - path: "assets/figma/variables/button-sm.json" - combine: file_name: "color-dark" merge: ["color-dark"] files: - path: "assets/figma/variables/color-accent-primary.json" mode: "primary" - path: "assets/figma/variables/color-accent-secondary.json" mode: "secondary" - path: "assets/figma/variables/color-status-success.json" mode: "success" - path: "assets/figma/variables/color-status-danger.json" mode: "danger" - path: "assets/figma/variables/color-dark.json" #Output path style_output_path: "assets/generated_styles/" templates: - settings_general: generate_file_path: "assets/generated_templates" file_name: format: "DS2{{style}}" extension: "swift" #case: "kebab" settings_custom: # For header and footer {{style}} is a secial variable that can be used header: - "import SwiftUI" - "public class DSCore{{style}} {" footer: - "}" template_type: # For themes - type: color value: "public static let {{variable_name | camel}} = {{value | color: 'Color(red: rgb_r_v1, green: rgb_g_v1, blue: rgb_b_v1, opacity: rgb_a_v1)'}} {{description | optional: '// desc = %value'}}" - type: boxShadow value: - 'public static let {{variable_name | camel}} = Shadow(x: CGFloat({{x-0}}), y: CGFloat({{y-0}}), color: Color(hex: "{{color-0 | color: ''hex''}}"), radius: CGFloat({{blur-0}}))' - 'public static let {{variable_name | camel}} = [Shadow(x: CGFloat({{x-0}}), y: CGFloat({{y-0}}), color: Color(hex: "{{color-0 | color: ''hex''}}"), radius: CGFloat({{blur-0}})), Shadow(x: CGFloat({{x-1}}), y: CGFloat({{y-1}}), color: Color(hex: "{{color-1 | color: ''hex''}}"), radius: CGFloat({{blur-1}}))]' - type: float value: "public static let {{variable_name | camel}} = CGFloat({{value | as_text_or_number}}) {{description | optional: '// desc = %value'}}" source: ["button-md", "button-sm"] - settings_general: generate_file_path: "assets/generated_templates_kt" file_name: format: "DS{{style}}" extension: "swift" #case: "kebab" settings_custom: # For header and footer {{style}} is a secial variable that can be used header: - "import SwiftUI" - "{% assign theme = '{{style}}' %} " - "public class DSCore{{theme}} {" footer: - "" - "}" template_type: - type: float value: "public static let {{variable_name | camel}} = CGFloat({{value | as_text_or_number}}) {{description | optional: '// desc = %value'}}" source: ["button-md"]