主文件中的@import局部mixins调用

时间:2018-07-02 10:16:03

标签: less

任何人都可以回答我有关LESS部分变量或mixins @import的问题。希望您会得到它。 见下文

asset
|-- Base/             (asset has Base folder)
|---- vars/           (Base has vars folder and "colors.less" in it.)
|----- colors.less    (variables defined "@red: red;", imported in vars.less below)
|---- vars.less       (Base has vars file too where variables @import "var/colors.less")
|-- Reset/            (asset has Reset folder)
|---- normalize.less  (called "color: @red;" in anchor tag, error shows)
|
|-- main.less         (@imported all files according to the structure)

这是代码-

|- main.less (its a main file, includes all files)

|   // Base
|-  @import "Base/vars.less";
|
|     // NOTE: its not called in main.less file, It's in BASE file
|     // File name 'vars.less' (I wrote it here to show you, Please check above structure)
|     @import "vars/colors.less";
|
|  // Reset
|- @import "Reset/normalize.less"

运行GULP,它会抛出类似 “变量@red未定义”

,当我使用SCSS并执行相同的局部@import时,它会运行,但不会在LESS中运行。 你能纠正我吗?

0 个答案:

没有答案