But I need to add this to every card and every message so far. Is there a way to add this piece of YAML in a generic way so it applies everywhere in my UI or at least in a specific dashboard?
Thanks for the help and adding all the variants. I have 0 experience with macros, but this sounds promising.
But still, would I need to import the macro in every single card and string of text? Or is there a way to import it once for the entire dashboard?
That’s kind of the point I’m trying to avoid.
For my understanding then. How is it that global dashboard rules apply? I mean, CSS or JS resources that we load on the frontend affect everything in our screen. Not just a single card. Themes are the same etc. How is that different?
I’m saying that there are files that can apply to an entire dashboard. Both CSS and JS files. That’s how themes work afaik. Or when we install a new card, it applies to any instance of the card that you add. So those files/rules are being applied globally.
Why can’t we do the same in this instance? Couldn’t I add this macro to the mushroom card files themselves?
Jinja isn’t handled in the frontend, it’s handled in the backend. Secondly, this is how you import reusable functions in jinja. There’s no way around it.
Can I do it in JS then? I’ll search the functions myself, I just want to know if it’s possible and if you can point me in the right direction on how to add the file or snippet so that it affects an entire dashboard.