'Condition on attribute in sass

I want to apply style depending on condition on the typa attribute provided by html like this:

<img src="pf_brise_lame_bdef_034.jpg?itok=3vKP-E25" width="325" height="183" alt="Présentation de l'Association" title="Présentation de l'Association" loading="lazy" typeof="Image" class="lazy-hidden">

So I don't know how to write the condition into my scss file, here is the starting point:

   $attribut:[typeof="Image"];
                @if $attribut == [typeof="Image"]{
                background: transparent;
                  a{
                      display: none;
                  }
                  }
                  @else {
                  background: $gris-anthracite;
                    a{
                        display: initial;
                    }
                  }

what could be the right syntax to achieve this ? into a li element.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source