# \[gelöst\] LESS Funktion

**URL:** <https://forum.shopware.com/t/gelost-less-funktion/43996>\
**Category:** Themes & Design\
**Created:** [23. Februar 2017 um 18:02 UTC](https://forum.shopware.com/t/gelost-less-funktion/43996 "2017-02-23T18:02:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [23. Februar 2017 um 18:02 UTC](https://forum.shopware.com/t/gelost-less-funktion/43996/1 "2017-02-23T18:02:28Z")

</div>

Hallo, ich habe ein Plugin und das Less will bei mehrfach when nicht rendern.&nbsp;

```
body{
  color: red;
}

.funktioneins() when (@variable = "eins"), (@variable = "zwei"), (@variable = "drei"){
  body{
    color: @farbegruen;
    i{
     color: blue;
    }
  }
  .irgendeineklasse{
    color: white;
  }
}
.funktioneins();

.funktionzwei() when (@variable = "vier"), (@variable = "funf"), (@variable = "sechs"){
  body{
    color: yellow;
  }
}
funktionzwei();

```

Daraus sollte resultieren:

```
// @variable = null
body{color: red;}

// @variable = ein, zwei oder drei, @farbegruen = green
body{ color: green;}
body i{ color: blue;}
.irgendeineklasse{ color: white;}

// @variable = vier, funf oder sechs
body{ color: yellow;}

```

heraus kommt aber nur:

```
body{ color: red}

```

Kein Renderfehler, einfach nichts. Weiss jemand Rat?

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [27. Februar 2017 um 16:11 UTC](https://forum.shopware.com/t/gelost-less-funktion/43996/2 "2017-02-27T16:11:12Z")

</div>

push. Wäre schön wenn ein LESS Profi hier mal schauen könnte. Danke.

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [27. Februar 2017 um 20:07 UTC](https://forum.shopware.com/t/gelost-less-funktion/43996/3 "2017-02-27T20:07:41Z")

</div>

ok, eine Eigenheit ist hier, dass die mögliche Variablenbedingung nicht in Anführungszeichen stehen dürfen. also **@variable = eins** statt **@variable = “eins”&nbsp;**. Und **or** statt \*\*, (komma)&nbsp;\*\*geht hier auch leider nicht. Mir scheint als ob der compiler nicht up to date ist?

---

<div class="post-metadata">

**Author:** ![MartinR](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@MartinR](https://forum.shopware.com/u/MartinR)\
**Post date:** [27. Februar 2017 um 21:23 UTC](https://forum.shopware.com/t/gelost-less-funktion/43996/4 "2017-02-27T21:23:14Z")

</div>

```
 Laut Less Doku: ![](https://i.imgur.com/XMeJHQg.png) Daraus ergibt sich und funktioniert: 

@variable: "zwei";

body{
    color: red;
}

.funktioneins(@variable: "null") when (@variable = "eins"), (@variable = "zwei"), (@variable = "drei") {
    body{
        color: green;
        i{
            color: blue;
        }
    }
    .irgendeineklasse{
        color: white;
    }
}
.funktioneins(@variable);

.funktionzwei(@variable: "null") when (@variable = "vier"), (@variable = "funf"), (@variable = "sechs") {
    body {
        color: yellow;
    }
}

.funktionzwei(@variable);

```

&nbsp;
