How Do I Install Less Css Compiler?

How Do I Install Less Css Compiler?

I just installed less css compiler using npm. Now thelesscfile directory is /usr/local/bin/lessc . i'm not clear what i need to change in lessc file and how to understand that compiler has been correctly installed.

3 Answers

  • To Install Less Compiler

    sudo npm install -g less
    
  • To know the location of it

    sudo which lessc
    
  • To compile ".less" File to ".css"

    lessc /home/--Your LESS File Location--/File.less > /home/--Your CSS File Location--/main.css 
    

/usr/local/bin/ should already be in your $PATH so there's nothing to do.

Simply use lessc like you would any other command. Here's a little snippet showing mine is installed like yours, and it parsing some LESS into CSS.

$ sudo npm install -g less
... npm installs less ...

$ which lessc
/usr/local/bin/lessc

$ lessc - <<< 'a{color:white; strong {color:black}}'
a {
  color: white;
}
a strong {
  color: black;
}
3

Installation:

sudo apt install node-less

Using:

lessc source_file.less file.css

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.