Skip to content

Dynamic class names used as mixin #1133

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

Closed
mattics opened this issue Jan 17, 2013 · 1 comment
Closed

Dynamic class names used as mixin #1133

mattics opened this issue Jan 17, 2013 · 1 comment

Comments

@mattics
Copy link

mattics commented Jan 17, 2013

I can create a new class by doing something like this

.makeNewBox(@colour) {
.box@{colour} {float: left; background-color: @colour;}
}

Which when called will give me something like
.boxgreen {float: left; background-color: green;}

But if I already have .boxgreen manually (or dynamically) created why can I not do this.

.makeMeAColour(@colour) {
.box@{colour};
// hoping to essentially do the same as specifically writing .boxgreen;
// I have already tried ~(".box@{colour}); with no luck
}

.container {
.makeMeAColour(green);
}
// what I intend would happen is that container is now green, but instead nothing happens

I can use a variable to set a class name, but I cannot use a variable to straight reference another class to use as a mixin. Is this a bug, purposely left out feature, or am I not using the syntax correctly?

@lukeapage
Copy link
Member

duplicate of #617

this is a feature that is not implemented. For all new language features we would like a use-case as to why you want to use it like this (other than it would be cool if you could..). If there is no existing solution for the problem then we look at what solutions will be best.

Please feel free to put your usecase into #617, thanks.

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