sass - How to generate class from nested maps -
I want to create classes for basic font-settings with SASS. I have fully managed that any of I can include my $ font-type from class nested maps, which includes responsive media-queries. My goal is to automatically map each font-type automatically to a square, with the $ font -type Which may include nested maps define settings I
How do I get it?
Here's the solution:
$ StyleHeams: (lead-1: (font-family: arial, font-size: 30px, font-size-MD: 20px , Font-size-SM: 12px,), lead-2: (font-family: arial, font-size: 18px, font-size-SM: 10px);); @ Christian $ theme, $ multiples in stylehames {{# subject subject} {@each $ prop, $ val $ properties {@if $ prop == font-family} {# $ $}: $ val; } @if $ prop == font-size {# {$ prop}: $ val; } @if $ prop == font-size-md {@ inline size-m {font-size: $ val; }} @if $ prop == font-size-sm {@ size-s {font-size: $ val; }}}} In this way, you can extend your "stylehoms" and add other font-sizes to specific breakpoint @s.
Comments
Post a Comment