Nits
Nits

Reputation: 550

How to automate compile less css without less js

I am a newbie in lesscss.

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

In future, I will deploy PHP code on apache server.

How to compile less css without node.js. Is there any alternative to compile lesscss before hand.

Case:

After changes in lesscss, I will automate compile my all less css files instead to go for manual because It will become tough for me to compile each less css file.

For automation what should I do?

Upvotes: 0

Views: 446

Answers (1)

henry
henry

Reputation: 4385

The simplest setup for compiling LESS beforehand is covered in the official "Using Less" documentation ("Installation" and "Command Line Usage" sections). Basically you'll do

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

If you make a main LESS file that imports the rest, you'll only have to run one lessc command. for example, main.less (the name could be anything) might look like

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

and you'd just run lessc main.less main.css

Upvotes: 1

Related Questions