在LESS import语句中使用变量

Tah*_*aus 8 css less

如果我要从同一目录导入多个文件,我想重用目录路径(假设带有import语句的文件与导入目标不在同一目录中).到目前为止,我试过这个:

@directoryPath: "../modules/core/less/";

@import @directoryPath + "file.less";
@import (@directoryPath + "file.less");
@import @{directoryPath}"file.less";
@import "@{directoryPath}file.less";

@filePath: @directoryPath + "file.less"; //I have verified this produces the proper string

@import @filePath;
@import @{filePath};
Run Code Online (Sandbox Code Playgroud)

6个import语句都不起作用.他们中的一些人在工作

source: url(/*LESS variables*/);
Run Code Online (Sandbox Code Playgroud)

声明,但在@import语句中的工作方式不同.关于什么会起作用的任何想法?

sev*_*max 12

请参阅文档变量>可变插值>导入语句.

正确的语法是:

@path: "../modules/core/less/";

@import "@{path}file.less";
Run Code Online (Sandbox Code Playgroud)