Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Possibility of referencing mixing to itself #374

Open
moseleyi opened this issue Feb 16, 2019 · 1 comment
Open

Possibility of referencing mixing to itself #374

moseleyi opened this issue Feb 16, 2019 · 1 comment

Comments

@moseleyi
Copy link

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
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants