Ingredients

Similar to units.yaml, also ingredients.yaml is not a mandatory file, but having it gives us several advantages.

  • spelling mistakes are not silently ignored, if something is not listed in ingredients.yaml, comfyrecipes will warn you
  • we can use aliases - different names referring the same ingredient
  • we will be able to add some more data to ingredients that will allow us to calculate prices (described in Prices and Conversions)
- myrecipes/
    - recipes/
        - pancakes.yaml
    ...
    - ingredients.yaml (we will be creating this file)

We will again use the final recipe from Quick Start.

🗎 myrecipes/recipes/pancakes.yaml:

title: Swedish Pancakes
ingredients:
  - 3 piece egg
  - 1.25 cup milk
  - 0.75 cup all purpose flour
  - 1 tablespoon white sugar
  - 1 tablespoon butter
steps:
  - Beat eggs in a bowl until the mixture is smooth.
  - Add milk
  - Mix flour, sugar and salt in a separate bowl
  - Mix together with the egg mixture, mix until it's smooth
  - heat a griddle
  - Drop just enough of the mixture to the griddle to spread to all corners
  - After about a minute, turn the pancake over

If you don't want to write the file manually, we can generate it using:

$ comfyrecipes generate-ingredients

This will generate a minimal ingredients.yaml:

🗎 myrecipes/ingredients.yaml:

- name: all purpose flour
- name: butter
- name: egg
- name: milk
- name: white sugar

Now, let's say we would want to call all purpose flour just flour, we can add an alias:

🗎 myrecipes/ingredients.yaml:

- name: all purpose flour
  aliases:
    - flour
- name: butter
- name: egg
- name: milk
- name: white sugar

Now whenever we add an ingredient called flour, it will be a reference to all purpose flour.

For a full reference for what an ingredients yaml can contain, please see the Ingredients Reference