oyejorge / less.php

less.js ported to PHP.
http://lessphp.typesettercms.com
Apache License 2.0
657 stars 2 forks source link

Possibility of referencing mixing to itself #374

Open moseleyi opened 5 years ago

moseleyi commented 5 years ago

Is it possible to reference mixin within itself, for example:

.rad(@r=5){
    border-radius:5px;
    &:hover{.rad(10);}
}

Seems that I get 500 error during compilation if I attempt to do it

seven-phases-max commented 5 years ago

It is possible. But you have to stop an infinite recursion somehow - for example see Recursive Mixins (in your snippet you simply have an infinite chain of :hover:hover:hover:hover:hover...).

For a theory also see Recursion.