Now I do not want to copy that code on top of every dashboard. So I was thinking to add it as a resource to dashboards. I created MASTER.yaml (local/www/master.yaml) that includes the decluttering_templates code part and tried to add it to my resources as stylesheet:
When using UI-driven dashboards - you have to paste SAME decluttering templates on a top of “raw yaml” page. After save, this “raw yaml” is converted to json; after reopening “raw yaml” page - converted to yaml and so on.
When having yaml-driven dashboards - you may share same decluttering templates stored in some yaml-file(s) between many dashboards. Details.
Many advanced users have yaml-driven dashboards for “main use”, and UI-driven dashboards - for testing only (and manually paste a decluttering template into “raw yaml” page when it is needed for initial testing).
I know no way you can use an external yaml file(s) in UI-driven dashboards.