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

variable values cannot be selectors without escaping #1328

Closed
maniqui opened this Issue May 16, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@maniqui

maniqui commented May 16, 2013

Example code (taken from less2css.org):

// Selector interpolation only works in 1.3.1+. Try it!
@theGoodThings: ~".food, .beer, .sleep, .javascript";

@{theGoodThings} {
  font-weight: bolder;
}

The value assigned to variable will also work if written this way (not escaped):

@theGoodThings: .food, .beer, .sleep, .javascript;

But will fail with a ParseError: Unrecognised input if any term has an hyphen (-) on it, like this:

@theGoodThings: .tasty-food;
@lukeapage

This comment has been minimized.

Show comment
Hide comment
@lukeapage

lukeapage May 16, 2013

Member

because it parses it as a css value. we do not parse for css selectors as variable values because we do not know what the variable is to be used as.

having said that maybe we should support a selector() function and everything inside is parsed as a selector?

Member

lukeapage commented May 16, 2013

because it parses it as a css value. we do not parse for css selectors as variable values because we do not know what the variable is to be used as.

having said that maybe we should support a selector() function and everything inside is parsed as a selector?

@maniqui

This comment has been minimized.

Show comment
Hide comment
@maniqui

maniqui May 21, 2013

Thanks for the answer, lukeapage, though I must admit I might not have understood it.
Let me try to rephrase the question:

Why this one works:

@somevar: .food;

but this one throws an ParseError: Unrecognised input:

@somevar: .tasty-food;

?

Both strings seems almost equal to me, only difference is that little hyphen on the second one, and that's enough to throw the error.

maniqui commented May 21, 2013

Thanks for the answer, lukeapage, though I must admit I might not have understood it.
Let me try to rephrase the question:

Why this one works:

@somevar: .food;

but this one throws an ParseError: Unrecognised input:

@somevar: .tasty-food;

?

Both strings seems almost equal to me, only difference is that little hyphen on the second one, and that's enough to throw the error.

@lukeapage

This comment has been minimized.

Show comment
Hide comment
@lukeapage

lukeapage May 28, 2013

Member

because of a fluke. - might mean maths or it might be part of a value so the value needs to be parsed properly. parsing properly we realise it isn't a css value.

Member

lukeapage commented May 28, 2013

because of a fluke. - might mean maths or it might be part of a value so the value needs to be parsed properly. parsing properly we realise it isn't a css value.

@stale

This comment has been minimized.

Show comment
Hide comment
@stale

stale bot Nov 14, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale bot commented Nov 14, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 14, 2017

@stale stale bot closed this Nov 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment