Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't reuse generated .@{name} classes as mixins #1206

Closed
syam44 opened this issue Feb 28, 2013 · 3 comments
Closed

Can't reuse generated .@{name} classes as mixins #1206

syam44 opened this issue Feb 28, 2013 · 3 comments

Comments

@syam44
Copy link

syam44 commented Feb 28, 2013

Hi,

I'm using LESS 1.3.3

When I generate classes like this:

#genMarginTop (@name, @size) {
    .@{name} { margin-top: @size; }
}
#genMarginTop(mtStandard, 60);

Then I can't reuse them as mixins even though they are perfectly usable in HTML:

.someClass { .mtStandard; /* more stuff */ }

It gives a NameError: .mtStandard is undefined

Sure I can work around that using a different generator:

#genMarginTop (@size) {
    margin-top: @size;
}
.mtStandard { #genMarginTop(60); }
.someClass { .mtStandard; /* more stuff */ }

But somehow this syntax feels clumsy, I'd rather generate the class directly using the @{name} syntax in the generator.

The problem seems to be that LESS doesn't register such generated classes in its "internal list" of available classes. It would be very nice if LESS could somehow "backtrack" those generated classes in order to be able to reuse them.

Thanks, and keep up the good work!

@lukeapage
Copy link
Member

duplicate, see #1196

@lukeapage
Copy link
Member

p.s. thanks for the thanks!

@syam44
Copy link
Author

syam44 commented Feb 28, 2013

Sorry for the duplicate, even though I saw #1196 in the list I didn't understand just from its title that it was related. I'll watch that thread instead.
Thanks again, for your reactivity in addition to all the rest. ;)

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

No branches or pull requests

2 participants