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

Allow passing a value with spaces without wrapping it as an escaped string #5

Closed
demoive opened this issue May 26, 2013 · 2 comments
Closed

Comments

@demoive
Copy link

demoive commented May 26, 2013

With any value that has spaces in it (e.g. 1px solid red), fails to generate a proper CSS definition since LESS treats the argument as an array of values. You can get around this in your solution by passing it in as an escaped string (e.g. ~"1px solid red"). Out of your test cases, the following seem to contain this bug:

.test-compound
.test-function-param-preserve-second
.test-function-param-preserve-first
.test-function-param-preserve-double
.test-nested-coumpoun

Here is an example of the failing output:

.property(transition, all .5s ease, "webkit moz o");

.test-compound {
  -test-should: generate a property definition that looks correct;
  -less-property: ;
  -webkit-transition: [all, 0.5s, ease];
  -moz-transition: [all, 0.5s, ease];
  -o-transition: [all, 0.5s, ease];
  transition: [all, 0.5s, ease];
}

In my solution, I encountered this same problem, but resolved it by escaping the argument before using it. In your mixin, if you escape both the @property and @value arguments into new variables, I think it would be more robust. For example:

.property(@property, @value, @prefixes: '', @base: true) {
  @prop: e('@{property}');
  @vals: e('{@value}');

  // ...
}
@borodean
Copy link
Owner

Thanks for your input, @demoive!

(Too bad it took me 7 years to get back to it 😅)

@demoive
Copy link
Author

demoive commented Feb 19, 2020 via email

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