-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Sending '!important' as an argument results in a syntax error. #100
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
Comments
+1 for this feature, or some equivalent. |
Have you tried:
I've used this hack when doing comma-separated values sent to a single variable, like so:
|
Clever, and useful in some cases, but not where the variable isn't inserted at the end of a property declaration, such as with gradient-generating mixins. |
Really? I can't think of a scenario where this syntax wouldn't work. Can you give an example? |
Sure. Look, for example, at this (truncated) gradient generating mixin from Bootstrap: #gradient {
.horizontal (@startColor: #555, @endColor: #333) {
background-color: @endColor;
background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @startColor), color-stop(100%, @endColor));
}
} Called as |
It just now strikes me that you may have been simply trying to solve @marioestrada's problem, in which case good on yah. I was thinking more about the generic usefulness of this feature, and for gradient mixins specifically. |
More generic solution added as #547. Then this could be called as |
I still don't really understand. The syntax can be used to pass in the value as is and avoid parsing errors with special values. I don't see how your example fails on background-image. In your example, these are (roughly) equivalent:
The only difference seems to be that the color value in the second line is translated into a six-digit value, which I didn't know. But in your example, either way would be valid. |
I know, sorry. My first example had a typo (fixed now). I meant |
Oh, I see, it's not the parser that fails, it's how you've defined the variables. Try this out:
Looks crazy, but seems to work. ^_^ |
Note that I agree with you that it is a bug that |
Hehe, thanks for that solution, but that would get very messy if implemented across an entire library. It would be better if this was built into the parser. (I'm not saying @cloudhead has any obligation to, just saying it would be the Wrong Solution to leave optional room for |
Hmmmm.... If your mixin had 14 lines of CSS, would you then expect every line to be appended with I rarely use the |
Response in #547: #547 (comment) |
implemented! see #547 |
Having:
Results on an error when trying to call it as:
This used to work on Less 1.2
The text was updated successfully, but these errors were encountered: