Closed piny940 closed 6 months ago
In https://yadm.io/docs/templates it says
If multiple classes are defined, yadm.class=="someclass" will be true if any of the defined classes are “someclass”.
Please try that, and let us know your results.
The classes are mango
and peach
:
$ yadm config --get-all local.class
mango
peach
In the test##template
, I've written:
{% if yadm.class=="mango" %}
mango
{% endif %}
{% if yadm.class=="peach" %}
peach
{% endif %}
However, the content of 'test' only became:
peach
It appears it only checks the result of yadm config local.class
.
@piny940 Can you try
{% if yadm.classes=="mango" %}
mango
{% endif %}
{% if yadm.classes=="peach" %}
peach
{% endif %}
Perhaps the doc is wrong on the syntax.
Unfortunatlly, it didn't work. The content of test
became empty.
I've written test##template
as follows:
{% if yadm.classes=="mango" %}
mango
{% endif %}
{% if yadm.classes=="peach" %}
peach
{% endif %}
Variables:
{{ yadm.class }}
{{ yadm.classes }}
Then the content of test
became:
Variables:
peach
{{ yadm.classes }}
It appears yadm.classes
does not work in template file.
I checked the version of yadm
and I found it was old.
$ yadm version
yadm 3.1.1
When I upgrade yadm to the latest version, everything worked fine. Thank you for your support.
This question is about
Describe your question
I've added multiple classes using yadm config local.class Hoge1 and yadm config --add local.class Hoge2.
Now, how can I utilize these classes in a template file?
I want to achieve something like this in
config##template
:I'm certain this question is related to #304 , but I'm unable to figure out how to use multiple classes in template files.
Thank you.
[A clear and concise description of the question.]