Parseerror in Less: Unrecognized input

问题内容:

I have a code in Less and I can’t run it. Shows Unrecognized input error.

I think this is the problem

@divnum: 20;

.rainbow(@counter) when (@counter > 0) {
    .rainbow((@counter - 1));
    // Mixin is called within itself, creating the loop, but will only work  while @counter > 0

@clr: @counter * 360/@divnum;
@top:  cos((@counter * 360/@divnum)deg) * 400px;
@left: sin((@counter * 360/@divnum)deg) * 400px;

div:nth-child(@{counter}){
    // nth-child is called based on the counter value
    background-color: hsl(@clr, 100%, 50%);
    position:relative;
    top: @top;
    left: @left;
 }
}

Can I use sin and cos in less? or is there something wrong with my code?

问题评论:

    
(1+2)deg <- this is not valid numeric value. You don’t add units to numbers like this in Less (For more details see #3118) And for proper methods see for example github.com/less/less.js/issues/1375#issuecomment-171446510.
    
In short: use cos(@counter * 360deg / @divnum) instead.

原文地址:

https://stackoverflow.com/questions/47753154/parseerror-in-less-unrecognized-input

Tags:,

添加评论

友情链接:蝴蝶教程