So in my lovelace yaml file I have a resource section that has lines with start with URL and lines of TYPE. Sometime Im told to put URL first and than TYPE and sometimes the other way. Sometime with a dash and sometimes without. YAML confuses me. maybe someone can shed light on this.
YAML is just a serialization language used as data input in many applications, so this is nothing specific to Home Assistant or Lovelace. The order of the different keys does not matter.
The most common constructs are keys, key-value pairs and arrays:
name: tomas # This is a key-value pair.
animals: # This an array or a list.
- Dog
- Cat
- Monkey
animals: [Dog, Cat, Monkey] # This is also an array or a list written in inline format.
name: # This is a key that does not require a value.
Whenever you are expected to prefix a value with a dash, it means that the key takes a list, i.e. you can, but do not need to, supply multiple values to the key.
1 Like
So URL and TYPE are both keys. Not sure I’m following.
Here’s an example:
resources: # Resources is a key that expects a list of urls.
- url: /local/my-custom-card.js # This is the first list item in the form of a key-value pair.
type: js # This is a key-value pair that is a sub key of the above list item.
- url: /local/my-webfont.css # This is the next list item, also a key-value pair.
type: css # This is a sub key to the above list item.
1 Like