Skip to content

How do I use a variable in less js as a command that appears before a parenthesis? #3606

Open
@desbest

Description

@desbest

How do I use a variable in less js as a command that appears before a ( bracket or parenthesis?
I asked on Stack Overflow and couldn't get any help.


.breadcrumb li:nth-child(2) a       { background:  darken(@breadcrumbrootback, 5%); }
.breadcrumb li:nth-child(2) a:after { border-left-color:  darken(@breadcrumbrootback, 5%); }

I would like to change darken( to @breadcrumbcolouraction( so the command is chosen based on a variable (so it could be either lighten or darken based on the value or a variable). How do I do this?

@breadcrumbcolouraction: "darken";
@breadcrumbcolouraction: "lighten";

In less version 4.1.1 if I changed darken to the variable @breadcrumbcolouraction, the less file would fail to compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions