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

Fix for #1760 #1764

Merged
merged 1 commit into from
Feb 1, 2014
Merged

Fix for #1760 #1764

merged 1 commit into from
Feb 1, 2014

Conversation

seven-phases-max
Copy link
Member

Fixes property interpolation (#1760). Now variables of any type (and their combinations) should expand properly.

auto: auto;
}
pi-complex-values {
3px rgba(255, 255, 0, 0.5), 3.141592653589793 /* foo */3px rgba(255, 255, 0, 0.5), 3.141592653589793 /* foo */: none;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to give an error than to allow this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to give an error than to allow this?

That's no so simple. Actually I was already about giving up a complete evaluation of a variable in a property when I saw it grows more complicated (and generate some error for "complex expansions" instead) but... But with a error detection it tends to become even more cryptic, consider the following code:

@p: ~' ' ~`1 + 1, "  "` /* foo */ bar;

z {
    @{p}: 0;
}

It's a bit exaggerated example of course but there's no way for the compiler to 100% decide if the property name is correct or it isn't unless we completely re-parse the result string all over again. So my main goal for this fix was just to make sure a variable is expanded "as is", i.e. the same way it works with selector interpolation (or within backticks interpolation), i.e. as in (#1760):

In general LESS never tests if its output is a valid CSS

This way we don't have to invent any new special rules for each interpolation type (and a user at least knows what to expect there w/o any special documentation). And this scary property test above is only to ensure the expansion works properly.

@lukeapage lukeapage merged commit bca1f99 into less:master Feb 1, 2014
@seven-phases-max seven-phases-max deleted the property-interp-fix-2 branch February 1, 2014 18:55
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

Successfully merging this pull request may close these issues.

2 participants