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

Evaluated Less Variables #2624

Closed
bjtomlin opened this issue Jun 30, 2015 · 2 comments
Closed

Evaluated Less Variables #2624

bjtomlin opened this issue Jun 30, 2015 · 2 comments

Comments

@bjtomlin
Copy link

I need to know the final values of a set of less variables after the less files have been parsed. For example:

variable.less contains:
@primary = #333333;
@secondary = lighten(@primary, 40%);
@accent = darken(@secondary, 10%);

I want to know the calculated values of secondary and accent. I don't need to use them in css but instead need to save them elsewhere.

Is this possible?

Also is it possible to know that secondary is based on primary?

@seven-phases-max
Copy link
Member

Please use backticks to format you code.
Additionally note that normally GitHub issue trackers are for bug/issue-reports/feature-requests and not for asking generic "How-Do-I?" questions (and this issue tracker is not an exception). Consider using an SO for example to ask a generic Less usage questions.


Either way:

I want to know the calculated values

Depends on what you mean by "know". For example in a simple case you can just compile something like:

whatever {
    secondary-value: @secondary;
    accent-value:    @accent;
}

and look at the output.

I don't need to use them in css but instead need to save them elsewhere.

Then are you sure Less is what you need actually? (maybe you're just looking for some generic color processing tool/library?)
Either way, the short answer would be "no", currently Less compiler is for generating CSS output and only CSS-output. Though see #2231, #2597 etc. for advanced tips and tricks (I.e. there is way to do that programmatically but it may be too complex for your actual needs).

@seven-phases-max
Copy link
Member

Closing as duplicate of #2597.

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