Použití bloku kódu pro animaci v LESS

Vytvořme funkci, která nastavuje klíčové snímky animace:

styles.less.keyframes(@name, @code) {
  @keyframes @name {@code();}
}

Použijme naši funkci:

styles.less.keyframes(anim, {
  from {
    width: 100px;
  }
  to {
    width: 200px;
  }
});

Výsledek kompilace:

styles.css@keyframes anim {
  from {
    width: 100px;
  }
  to {
    width: 200px;
  }
}