Skip to content

github action to ensure svg fulfills requirements regarding css classes/inline css #407

@amacado

Description

@amacado

As proposed in #403 and #400 we would like to introduce a new requirement for adding SVG icons to this project:

SVGs are not allowed to have classes for defining properties but instead enforcing inline css to declare styling. This might not considered best practice in general but in this case it provides a cleaner look of your icons and solving decleration issues which can occur when classes are beeing used.

Bad example (no longer allowed)

      <svg viewBox="0 0 128 128">
        <defs>
          <style>
            .cls-1 {
              fill: #cb3837;
            }
          </style>
        </defs>
        <title>Artboard 5</title>
        <path
          id="original-wordmark"
          class="cls-1"
          d="M2,38.5H126V82.21H64V89.5H36.44V82.21H2ZM8.89,74.93H22.67V53.07h6.89V74.93h6.89V45.79H8.89ZM43.33,45.79V82.21H57.11V74.93H70.89V45.79Zm13.78,7.29H64V67.64H57.11Zm20.67-7.29V74.93H91.56V53.07h6.89V74.93h6.89V53.07h6.89V74.93h6.89V45.79Z"
        ></path>
      </svg>

Improved example (what the rule should enforce)

      <svg role="img" viewBox="0 0 128 128">
        <path
          fill="#cb3837"
          d="M2,38.5H126V82.21H64V89.5H36.44V82.21H2ZM8.89,74.93H22.67V53.07h6.89V74.93h6.89V45.79H8.89ZM43.33,45.79V82.21H57.11V74.93H70.89V45.79Zm13.78,7.29H64V67.64H57.11Zm20.67-7.29V74.93H91.56V53.07h6.89V74.93h6.89V53.07h6.89V74.93h6.89V45.79Z"
        ></path>
      </svg>

Since this can be checked automated it would improve the reviewing process when this rule would be checked by a gihub action on every pull request.

Metadata

Metadata

Assignees

Labels

devopsDevops/automation related enhancementsdiscussionCommunity discussions about changes/features/..enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions