我有以下文件结构:
--public_html/
- css/
- less/
- _mixins.less
- _variables.less
- _theme.less
- main.less
我正在使用 PhpStorm 和一个从 NPM 运行 LESSC 的文件观察器。
我的文件观察器如下:
Program: /usr/local/bin/lessc
Arguments: --no-color $FileName$
Output paths to refresh: ../$FileNameWithoutExtention$.css
文件:
main.less:
@import "_variables.less";
@import "_mixins.less";
@import "_theme.less";
_theme.less
包含我的样式表,_variables.less
和 _mixins.less
都是不言自明的。
当我修改并保存 main.less
文件 main.css
时,它应该在 css
文件夹中创建。
但是,当我编辑我的 _theme.less
文件时,LESSC 也会创建一个 _theme.css
文件。
如何停止创建这些额外的文件?
如果您需要更多信息,请询问。
最佳答案
请确保在该特定文件观察器设置中启用了仅跟踪根文件
选项——它就是这样做的。
来自 https://www.jetbrains.com/help/phpstorm/2016.3/new-watcher-dialog.html#d199014e291
When the File Watcher is invoked on a file, PhpStorm detects all the files in which this file is included. For each of these files, in its turn, PhpStorm again detects the files into which it is included. This operation is repeated recursively until PhpStorm reaches the files that are not included anywhere within the specified scope. These files are referred to as root files (do not confuse with content roots).
- When this check box is selected, the File Watcher runs only against the root files.
- When the check box is cleared, the File Watcher runs against the file from which it is invoked and against all the files in which this file is included recursively within the specified scope.
关于css - LESSC 将包含的文件编译成 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42920442/