Add-on Development - How to replace a YAML value in a file?

Is there a preferred way to replace specific values in a YAML file?

I'm creating an add-on that allows admins to edit some global variables in the theme.yaml file. This would allow clients to edit global variables like phone number, contact email, etc. The theme.yaml has some comments and other variables I want to preserve.

Is there way method to pass an updated value to a YAML file and have it update/replace only that variable/value?

>>>>>>> Unanswered <<<<<<<
12 Replies
3 Followers