Reusing card wrappers like mod-card

I’m working on transitioning my dashboard to yaml mode to declutter, break up the miles long yaml files, and try to reuse duplicated code.

I have quite a few cards that are wrapped in a mod card like below, and I thought I could just throw it in a separate yaml file and start the card files off with including it. But I get yaml errors no matter how I try to split them up, and I’m sure it’s just something obvious.

Here’s an example of the file

!include /config/dashboards/home/cards/mod-card.yaml

    type: custom:notify-card
    target: tts.cloud_say
    ...rest of card

mod-card part for re-using:

type: custom:mod-card
card_mod:
  style: |
    ha-card {
      background: none;
      border:none;
      margin-top: 20px;
      width: 95% !important;
      font-size: 12pt;
      font-weight: 500;  
      margin: 0 auto;
    }
card:

mapping values are not allowed here in "/config/dashboards/home/cards/tala.yaml", line 3, column 5

You can apply card mod to all your cards in themes.

Oh, damn, that’s amazing!

1 Like