css - LESSC 将包含的文件编译成 CSS

标签 css less phpstorm precompile file-watcher

我有以下文件结构:

--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/

相关文章:

html - Wordpress 子主题未出现在仪表板中

node.js - Netbeans Less CSS(Node.js 预处理器)无法识别 Mixin

ubuntu - npm installsails 尝试在 1.7.5 版本安装 less

phpstorm - 如何在 phpStorm 中更新 CSS3 验证器?

phpstorm - 除了TODO或FIXME,还有更多方法可以在PHPstorm中突出显示注释吗?

linux - PhpStorm 远程 Xdebug

html - 将背景图像放在 Bootstrap 登录启动页面上

html - 我可以根据页面大小设置字体大小吗?

css - 如何将变换比例限制为 CSS 中父元素的宽度和高度?

css - less有像SCSS那样的 "respond-to"技术吗