Variable Name Error “is undefined” even though “variables.less” imported

前端 未结 10 2021
清歌不尽
清歌不尽 2020-12-08 18:41

I started using LESS today. But it\'s kinda weird. This code does not work. I get an error:

! Variable Name Error: @linkColor in a is undefined.
10条回答
  •  心在旅途
    2020-12-08 19:03

    One other weirdly specific situation in which this occurs: if you're using .NET and dotless, the compiler will choke on nested media queries with variable specifiers. If you have code like this:

    @media (min-width: @aVariable) {
        .some-class{
            margin: 10px;
    
            @media (min-width: @anotherVariable) {
                margin: 20px;
            }
    }
    

    ... then dotless will tell you that it can't find the definition for @anotherVariable, even if it's used three lines above.

提交回复
热议问题