Skip to content

Dynamic class names used as mixin #1133

Closed

Description

@mattics

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?

Activity

  1. lukeapage commented on Jan 18, 2013

    @lukeapage
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions