You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm crating a basic Theming engine that takes yml files as input. I need it to be able to inherit from each other like this
theme1.yml
padding:
small: 8
large: 16
theme2.yml
padding:
large: 24
this should give the output
padding:
small: 8
large: 24
right now I'm doing like this:
struct Theme {
struct Dimen {
{% for key, value in files[0].documents[0].data.padding %}
let {{key}}: CGFloat = {% if files[1].documents[0].data.padding[key] %}{{files[1].documents[0].data.padding[key]}}{% else %} {{value}} {% endif %}
{% endfor %}
}
}
This is extremely convoluted and will get even more crazy if the nesting is deeper. Ideally the xml files inputtet should get merged som the context in the stencil is already merged. How would I approach something like this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm crating a basic Theming engine that takes yml files as input. I need it to be able to inherit from each other like this
theme1.yml
padding:
small: 8
large: 16
theme2.yml
padding:
large: 24
this should give the output
padding:
small: 8
large: 24
right now I'm doing like this:
This is extremely convoluted and will get even more crazy if the nesting is deeper. Ideally the xml files inputtet should get merged som the context in the stencil is already merged. How would I approach something like this?
Beta Was this translation helpful? Give feedback.
All reactions