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

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

    There may be another possible root cause.

    Here is my original Gruntfile.js:

    less: {
          compile: {
            files: {
              'css/less.css': 'less/**/*.less'
            }
          }
        },
    

    The wildcard makes LESS compiler compile all .less files under that folder and merge all results into one CSS. And I got errors running grunt less:compile:

    NameError: .transition is undefined in less/core/html.less on line 38, column 3

    Once I changed 'less/**/*.less' into 'less/css.less', the compilation succeeds.

提交回复
热议问题