导入LESS w / out创建其单独的CSS输出文件 [英] Import LESS w/out creating its separate CSS output file
问题描述
(我已搜索过各种答案,但找不到任何相关的内容。)
我有两个LESS文件,例如 file1。少
和 file2.less
。 file1.less
包含导入 file2.less
。文件被编译成.css OK,所以我有 file1.css
但问题是 file2.less
是ALSO编译除了在 file1.css
中导入的内容之后,还可以将 file2.css
也就是说,我有复制的内容 file2.less
- 在编译的 file1.css
和它自己的单独的 file2.css
。
有任何方法可以使 file2.less
导入, file1.less
code> file2.css ? (我使用WebStorm插件编译器,如果有意义的话)。
为了使它清晰,这里是我有: >
file1.less(例如,包含 body {font-size:100%;}
和@import file2.less )
file2.less(假设它包含 body {background-color:#ffffff;}
)
结果:
file1.css与
-size:100%; }
body {background-color:#ffffff; }
AND
file2.css与 {background-color:#ffffff; }
(重复的!)
如何防止file2.css被创建,只是导入file1?
这与编译器有关,而不是LESS问题。我从来没有使用过这个编译器,但我可以建议你使用 http://winless.org/ 如果你是Windows用户(或在Mac上 less.app )。
Winless监视文件夹和子文件夹以进行修改(在.less文件中),并根据您定义为引导程序的文件创建.css。
(I have searched various answers, but couldn't find anything relevant.)
I have two LESS files, say, file1.less
and file2.less
. file1.less
contains import of file2.less
. Files are compiled into .css OK so I have file1.css
but the problem is that file2.less
is ALSO compiled into file2.css
besides its imported contents in file1.css
. That is, I have duplicate contents of file2.less
- in compiled file1.css
and its own separate file2.css
.
Is there any way to have file2.less
imported and file1.less
and NOT create its own file2.css
? (I use WebStorm plugin compiler, if it matters.)
To make it visually clear, here's what I've got:
file1.less (e.g., contains body { font-size: 100%; }
and "@import file2.less")
file2.less (let's say it contains body { background-color: #ffffff; }
)
RESULTS:
file1.css with
body { font-size: 100%; }
body { background-color: #ffffff; }
AND
file2.css with body { background-color: #ffffff; }
(duplicate!!!)
How do I prevent file2.css from being created and just have it imported into file1?
This is something related to your compiler, not a LESS issue. I have never used this compiler of yours myself but I can suggest you to use http://winless.org/ if you are a Windows user (or less.app on Mac).
Winless watches a folder and subfolders for modifications (in .less files) and creates a ".css" based on the file you define as your bootstrap.
这篇关于导入LESS w / out创建其单独的CSS输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!