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

前端 未结 10 2018
清歌不尽
清歌不尽 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:20

    I would use the nested rules in the normalize.less :

    a {
         color: @linkColor;
    
         &:visited {color: @linkColor;}
    
         &:hover {color: @linkColorHover;}
    }
    

    And in the @import, you don't need to use the ".less", it's optional :

    @import "variables";
    @import "normalize";
    

    I don't know if this can help...

提交回复
热议问题