Is there any chance to somehow comment my custom widget ?
Thanks
Alex
Actually, there isn’t, as the yaml code is stored in JSON files, which makes parsing very hard, if it would also include comments.
ok,
It’s not good information for me, because my custom widget is getting more and more complicated, I’m searching for the way, how to store informations, why I did it as I did it for the future
There is a basic workaround which I use. Any line commented out in the yaml will get removed when the widget is saved to the jsondb and reloaded. However, because the system doesn’t keep track of every single possible option that can be sent to the underlying f7 components it keeps all the keys in the config
object. Any unused keys are just ignored not removed. So I just add a comment
key to the config object wherever I need a comment. For example:
- component: oh-button
config:
text: Click this button
comment: TODO - fix the styling on this button
You also can do multi-line comments using the yaml muilt-line syntax, which I prefer to do because they are more visually offset in the widget editor:
- component: oh-button
config:
text: Click this button
comment: >
TODO
- fix the styling on this button
- debug expression in class parameter
ok, thanks
not perfect. But if it’s the only option, I must think about it.
That is brilliant! We should add that to the tips and tricks page in Getting Started.