Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile lesscss using node.js

Hi,
I have finished to code my website using lesscss client side and now want to compile less so I have donwloaded node.js. My website is running on localhost and I want first to know:

  1. where I have to install node.js
  2. what I have to do next ( commands lines tools, commands lines etc. ).

If someone can help me because I'm a newbie in this field.

Thanks.

like image 905
stephan lemaitre Avatar asked Dec 14 '22 23:12

stephan lemaitre


1 Answers

You can install the LESS compiler directly from npm.

  1. Install node.js. Go to this page and download the installer for your platform.
    If you're on Windows, download the .msi; if you are on OSX, download the .pkg file. Whenever possible, download the 64-bit version (unless your system is running only 32-bit hardware and software). If you are on Linux and you want to use package managers, see this page.
  2. Once you have node.js installed, you should also have npm, which is node.js Package Manager. You can open a terminal/console and run npm -v to make sure everything is installed correctly.
  3. Eventually, you can install the LESS compiler by simply executing:

    npm install -g less
    

(note: on OSX and Linux you may need to run this with sudo: sudo npm install -g less).

The LESS compiler will then be available as the lessc command. See examples here.

PS: Some GUIs also exist for simplifying working with lessc. Google "less gui windows/mac/linux" to see many results, like this one for Mac.

like image 118
ItalyPaleAle Avatar answered Jan 05 '23 13:01

ItalyPaleAle