Dejan
Dejan

Reputation: 731

Join two .less files into one css file

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

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?

Upvotes: 19

Views: 13439

Answers (2)

Dan Herbert
Dan Herbert

Reputation: 103397

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

@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.

Upvotes: 24

Bijan
Bijan

Reputation: 26469

Simple solution:

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

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

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

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

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

  4. Smile :)

Upvotes: 12

Related Questions