PHPStorm实现自动编译less文件

一、下载nodejs

https://nodejs.org/en/

 

二、安装,一直“Next”

PHPStorm实现自动编译less文件

 

三、检查是否安装成功

PHPStorm实现自动编译less文件

 

四、安装lessc模块

 

cmd     // 打开cmd控制台

cd F:\Program Files\nodejs\node_modules\npm     // 进入npm包管理模块

npm install less     // npm命令安装less模块

 

PHPStorm实现自动编译less文件

 

五、安装less-plugin-clean-css插件(less的插件,用于压缩代码)

 

cd F:\Program Files\nodejs

npm install less-plugin-clean-css

 

 

六、重启电脑(必须,否则下面不会自动编译成功)

 

七、PHPStorm自动编译less文件:settings->搜索file watchers ->添加

PHPStorm实现自动编译less文件

 

OK~,接下来你在项目里编辑less文件时,会自动时时生成css文件了

效果如下:

PHPStorm实现自动编译less文件