如何在没有js的情况下自动编译更少的css


How to automate compile less css without less js

我是一个新手。

using JavaScript is discouraged at the production stage as it will badly affect the website performance

将来,我将在apache server上部署PHP代码。

如何在没有node.js的情况下编译更少的css。还有别的办法吗先编译lesscss

:

在修改lesscss后,我将automate compile my all less css files改为手动,因为对我来说编译每个lesscss文件会变得很困难。

对于自动化,我应该怎么做?

预先编译LESS的最简单设置在官方"使用LESS"文档("安装"answers"命令行使用"部分)中有介绍。基本上你会写

$ npm install -g less
$ lessc inputfilename.less outputfilename.css

如果您创建一个主要的LESS文件来导入其余部分,那么您只需要运行一个lessc命令。例如,main。Less(名称可以是任何东西)可能看起来像

@import 'myfirstfile';
@import 'somedirectory/anotherfile';
@import 'somedirectory/yetanother';

然后输入lessc main.less main.css