将两个.less文件加入一个css文件中

时间:2022-09-01 22:47:52

When working with lesscss I would like to join two or three .less files into one super css file.

使用lesscss时,我想将两个或三个.less文件加入一个超级css文件中。

I know that you can do it using some little ruby magic, but I would like to know if there is something simple in the less engine?

我知道你可以使用一些小红宝石魔法来做到这一点,但我想知道在少引擎中是否有一些简单的东西?

2 个解决方案

#1


23  

You can use import, similar to how you can in a regular CSS file.

您可以使用导入,类似于常规CSS文件中的方式。

@import "reset";
@import "config";
@import "header";
@import "forms";

Taken from this SO post. It's also mentioned in the "Importing" section of the Less Documentation.

取自这篇SO帖子。在Less Documentation中的“Importing”部分也提到了它。

#2


12  

Simple solution:

  1. Create a main.less file and open it (name it as you like)

    创建一个main.less文件并打开它(根据需要命名)

  2. Import your other css and less files via @import

    通过@import导入您的其他css和更少的文件

    • @import "filename.less"; for less files

      @import“filename.less”;少文件

    • @import "filename.css"; for css files.

      @import“filename.css”;对于css文件。

  3. Compile your main.less file and just include this main.css in your site

    编译您的main.less文件,并在您的站点中包含此main.css

  4. Smile :)

    微笑:)

#1


23  

You can use import, similar to how you can in a regular CSS file.

您可以使用导入,类似于常规CSS文件中的方式。

@import "reset";
@import "config";
@import "header";
@import "forms";

Taken from this SO post. It's also mentioned in the "Importing" section of the Less Documentation.

取自这篇SO帖子。在Less Documentation中的“Importing”部分也提到了它。

#2


12  

Simple solution:

  1. Create a main.less file and open it (name it as you like)

    创建一个main.less文件并打开它(根据需要命名)

  2. Import your other css and less files via @import

    通过@import导入您的其他css和更少的文件

    • @import "filename.less"; for less files

      @import“filename.less”;少文件

    • @import "filename.css"; for css files.

      @import“filename.css”;对于css文件。

  3. Compile your main.less file and just include this main.css in your site

    编译您的main.less文件,并在您的站点中包含此main.css

  4. Smile :)

    微笑:)