I keep my recipies on my website, and like most of my website it grew over time instead of being designed. A couple years ago I added some progressive enhancement that puts checkboxes on the ingredients, and today I added a rescaler:
Here’s tripling it:
This is another project, like adding transposition to my solstice songbook, where I wouldn’t have put in the time if I couldn’t delegate to an LLM. It went very quickly, and the code seems reasonable.
Implementation notes:
As you go up and down it converts teaspoons to tablespoons to cups. Yes, I still cook volumetrically.
It handles numeric ranges, like “3-4 cups”.
It handles fractions: half of 1 1⁄4 C is 5⁄8 C.
It doesn’t handle everything. I wanted something simple and reviewable that handles most cases, instead of trying to make something exaustive (that would then have weird bugs). This means with complex items like “2 eggs (or 2T flax and 5T water)” only the “2 eggs” is scaled. To make these failures graceful, all scaled values are bolded, so unscaled values stick out visually.
3x ingredients still only makes 1doz muffins. :) I appreciate why you don’t want to detect and scale everything that might be a scalable thing, but maybe “how much does this make?” should be handled.
The “how much does it make” isn’t recorded in a consistent way, so it would require going over all the recipes to mark them up (or lots of special-case code) to make it rescale.
But when you rescale all the modified portions turn bold, so you can at least see that this hasn’t changed.
You might want to make “wets” appear next to the ingredients, like “dries” is, with the scaler buttons above. Probably the vibecode just put it in a weird place.
Thanks for pointing that out; I completely didn’t notice it had put the scaler in the wrong part of the page! Moved it to always go at the beginning.