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

strictMath #1501

Closed
ShootingStarr opened this issue Aug 21, 2013 · 6 comments
Closed

strictMath #1501

ShootingStarr opened this issue Aug 21, 2013 · 6 comments

Comments

@ShootingStarr
Copy link

I use codekit and can not set an option in the console, please tell me which file to change the settings "strictMath:true" ?

.oval {
  -webkit-border-radius: 20px / 10px;
  -moz-border-radius: 20px / 10px;
  border-radius: 20px / 10px;
}

output:

.oval {
  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  border-radius: 2px;
}
@Soviut
Copy link

Soviut commented Aug 21, 2013

You should report this to CodeKit and let them know they should add an options panel for LESS https://github.com/bdkjones/CodeKit/issues

However, there was discussion about having an @options block you could set right in the stylesheet.

#1134

@Soviut
Copy link

Soviut commented Aug 21, 2013

Also, why don't you just wrap your math in parenthesis?

.oval {
  -webkit-border-radius: (20px / 10px);
  -moz-border-radius: (20px / 10px);
  border-radius: (20px / 10px);
}

Or even better:

.oval {
  @radius: (20px / 10px);
  -webkit-border-radius: @radius;
  -moz-border-radius: @radius;
  border-radius: @radius;
}

@ShootingStarr
Copy link
Author

strictMath in panel CodeKit, present, but it does not help.
1

input:

.oval {
  @radius: (20px / 10px);
  -webkit-border-radius: @radius;
  -moz-border-radius: @radius;
  border-radius: @radius;
}

output:

.oval {
  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  border-radius: 2px;
}

if I write in .less file

@options {
  strictMath: "true";
}

CodeKit shows pars error.

@Soviut
Copy link

Soviut commented Aug 21, 2013

If disabling strict math in CodeKit does nothing, then that's a bug on their end.

And if you're using parenthesis then strictMath doesn't matter. StrictMath means all math operations need to be wrapped in parenthesis. The reason for this is because / is now valid when used in font shorthand and can confuse the compiler.

The @options block is still under debate so do NOT use it. I was just pointing you there to let you know where to go if you wanted to discuss it. Do not try and use it in your stylesheet.

@jonschlinkert
Copy link
Contributor

to reiterate what @Soviut is saying, @options block is just a feature request atm. I would imagine that any feature that doesn't exist would throw an error lol.

@Soviut
Copy link

Soviut commented Aug 21, 2013

Exactly. To summarize:

If strictMath is ON, you must wrap all math operations in parenthesis: width: (100px / 5px);

If strict math is OFF, you do not need to wrap math operations: width: 100px / 5px;
However, you will not be able to use the CSS3 font shorthand for setting font size and line height at the same time.

Do NOT use @options, it is still only a feature request.

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

3 participants