Card-mod - apply identical card-mod to multiple items?

Hi - I am using card-mod extensively to modify look & feel of a bunch of stock symbol grids - upwards of about 50 individual stocks / indexes, etc. The card-mod is identical on all of them. Wondering if there is any way to “include” a card-mod style and use a variable rather than having to write card-mod for every single graph? I’m envisioning a file that could be called to include the script possibly? Thoughts?

Sample image: (background color and icon indicate today up or down, border-top green indicates trading above 50 day average, border-bottom red indicates trading below 50 day average)
image

Sample card-mod script for 3M: (as you can see I already set the variable name and then use it throughout card-mod so I don’t have to retype/recopy when I update the script…):

entities:
  - sensor.yahoofinance_mmm
graph: line
hour24: false
hours_to_show: 12
points_per_hour: 30
name: 3M Company
decimals: 2
show:
  extrema: false
  icon: true
  name: true
  legend: false
type: custom:mini-graph-card
card_mod:
  style: |
    {% set symb = 'sensor.yahoofinance_mmm' %}
    ha-card {
      box-shadow:
        {% if states(symb)|float(0) 
          > state_attr(symb,'fiftyDayAverage')|float(0) %}  
           inset 0px 5px 0px 0px rgb(0,215,0,1) 
        {% else %}
            inset 0px -5px 0px 0px rgb(255,0,0,1)  
        {% endif %};
      background-color: 
        {% if state_attr(symb,'regularMarketChange')|float(0) > 0 %} 
             rgb(0,255,0,0.05) 
        {% else %} rgb(255,0,0,0.2)
        {% endif %};
        
    font-size: 80% !important;
    }
      .states.flex {
    flex-direction: column;
    }
    .states.flex::after {
      color: white;
      padding-top: 16px;
      content: "50 Day: {{ '{:.2f}'.format(state_attr(symb,'fiftyDayAverage')|float(0)|round(2)) }}";
    }
    :host {
      --paper-item-icon-color: 
          {% if is_state_attr(symb,'trending','up') %}
            rgba(170, 255, 0,1); 
          {% elif is_state_attr(symb,'trending','down') %}
            rgba(255,0,0,1);
          {% else %}
            white;
          {% endif %}
      }

anchors, include, secrets, card-mod themes, decluttering card

I’m sorry I don’t understand. Do you have an example maybe, even if it’s pseudo-code?

anchor (google about anchors and other things mentioned above):

type: custom:mini-graph-card
card_mod: &ref_style
  style: |
     ha_card {...}
....
type: custom:mini-graph-card
card_mod: *ref_style
....
type: custom:mini-graph-card
card_mod: *ref_style

include:

type: custom:mini-graph-card
card_mod: !include /config/..../xxxxxxxxxxxxxxxx.yaml

where xxxxxxxxxxxxxxxx.yaml

style: |
 ha-card {...}

secrets:

type: custom:mini-graph-card
card_mod: !secret xxxxxxxxxxxxxxxx

where secrets.yaml:

xxxxxxxxxxxxxxxx:
  style: |
   ha-card {...}

card-mod themes - check card-mod repo + a huge card-mod themes thread in community
Same about decluttering card.

awesome… thank you. I have a lot of learning to do, but appreciate the additional detail to help get me under way!

I stumbled on something while searching for above answers, and it actually solves it perfectly for my use case.

use decluttering card - lets me specify the exact card, card mod, and pass variables into the template such as entities and other items. So this is my solution… thanks though for the previous suggestions, they will come in useful one day I’m sure!