While working with Less and font shorthand, I came across an issue:
.font(@weight: 300, @size: 22px, @height: 32px) {
font: @weight @size/@height "Helvetica Neue", Arial, "Liberation Sans", FreeSans, sans-serif;
}
The above code snippet resulted in an error message:
this.a.toCSS is not a function
http://localhost/tumblr/modern1/css/style.less on line 1, column 0:
1. @highlight: #cb1e16;
2. @shade1: #cb1e16;
However, when I separated the properties, it worked fine:
.font(@weight: 300, @size: 22px, @height: 32px) {
font-weight: @weight;
font-size: @size;
line-height: @height;
font-family: "Yanone Kaffeesatz", "Helvetica Neue", Arial, "Liberation Sans", FreeSans, sans-serif;
I believe the issue lies with the slash (/) causing a problem. Since Less can perform calculations like 2px + 5 = 7px
, it may be attempting to divide instead.