PHPStorm中较少的Filewatcher编译器

asp*_*aga 13 less phpstorm

在尝试使用PHPStorm File观察器编译.less文件时.css,我做错了什么?

这是截图,(请打开此链接以查看图像的完整大小): 在此输入图像描述

我安装npm install -g less后安装了NodeJS.lessc使用cmd.exeWindows操作系统中的命令行工具时,它可以正常使用此命令:

lessc custom.less custom.css,但它不会在Filewatcher中的PHPStorm中做任何事情.

任何线索,我应该纠正,请?

asp*_*aga 39

对于那些想在IDE PHPStorm中配置LESS自动编译器的人,可以这样做:

  1. 下载并安装Node.js.
  2. 打开终端/ Shell /命令行,cmd.exe用于Windows环境
  3. 命令行终端内,键入npm install -g less并等待LESS下载和安装.
  4. 在PHPStorm中打开设置窗口:文件>设置(CTRL + ALT + S)
  5. 导航到文件监视器(或在"设置"窗口中搜索)
  6. 单击"设置"对话框右侧的+以创建新的文件监视器,并按照图片所示进行配置:
    在此输入图像描述
    这就是你的文件夹结构在上一张图片上的设置的样子:
    在此输入图像描述
  7. 保存并测试它,每次在.less文件中键入内容时,它将自动编译到.css您之前在File Watcher的设置对话框中定义的内容中.
    要解开源较少的文件,创建一个template.less如图所示的内容,并在完成任何样式之前将源文件下载到那里.


/*!
 * Your commented code which wouldn't be removed in compiled .css because of "!" mark
 */
 /*
  * This comment will be removed in compiled .css file because of no "!" after "/*"
  */

// Core source files of Twitter's Bootstrap
@import "bootstrap/bootstrap";
@import "bootstrap/responsive";

// Core source file of Font Awesome Icons
@import "font-awesome/font-awesome";

// Connected plugins
@import "plugins/datepicker";
@import "plugins/redactor";

/*!
 * General template styles below
 */

/* -------------------------------------------------------------- */
/**** PRECONFIG, OVERRIDES, VARIABLES, TYPOGRAPHY ****/
/* -------------------------------------------------------------- */
// VARIABLES.LESS Override
//---------------------------------------------------------------
// Colors
@whiteSmoke:            #f5f5f5;

// Typo
@sansFontFamily:        "Helvetica Neue", Helvetica, Arial, sans-serif;
@serifFontFamily:       Georgia, "Times New Roman", Times, serif;
@monoFontFamily:        Monaco, Menlo, Consolas, "Courier New", monospace;
Run Code Online (Sandbox Code Playgroud)

  • 哇,这很难做,希望它会及时改善 (2认同)
  • 我不能对你发表这个解决方案表示感谢,因为这似乎是唯一可行的解​​决方案而且我非常沮丧地试图找到合适的解决方案.谢谢TON分享! (2认同)