-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
store variables in less.vars, please ! #3435
Comments
Accessing vars is not out of the question, but your use-case is strange. Why isn't your stylesheet simply styling the body? |
Juts in case adding a few tricky snippets to test this feature when (and if) developed:
div {
color: @color;
}
.mixin() {
@color: red;
} .mixin;
@color: darken(@c, 42%);
div.a {
@c: blue;
color: @color;
}
div.b {
@c: green;
color: @color;
}
.-{@c:red}.-;
@color: .foo.bar(blue)[];
div {
color: @color;
}
.foo {
.bar(@c) {
return: spin(@c, 180);
}
} |
@seven-phases-max Yeah, I didn't want to get into it with the OP, but essentially you would need to evaluate the full sheet, and then could theoretically access eval'd tree to extract a value. The reason why I (tentatively) marked it as a So, if you can load a bundle, then eval it, you could optionally then attach it as a stylesheet, or extract values from the eval'd tree (or both). 5.0 is still very early in development, but I just wanted to stick a pin in this as a feature to keep in mind. With the right code path, supporting this would theoretically not add any extra overhead. |
i use less client side,
all i want is
document.querySelector("body").style.backgroundColor = less.vars["background-color"];
this is would be so easy
The text was updated successfully, but these errors were encountered: