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

时间:2016-10-13 12:56:25

标签: php less

我是lesscss的新手。

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转而去手动,因为编译每个较少的css文件对我来说很难。

对于自动化,我该怎么办?

1 个答案:

答案 0 :(得分:1)

官方"Using Less" documentation(“安装”和“命令行用法”部分)中介绍了事先编译LESS的最简单设置。基本上你会做

$ 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