Setting up and using Less in a project
The following section will take you through a step-by-step guide to get you started with Less. Once we’ve installed Less and its associated packages, we’ll create and compile our first Less project.
Installing Node.js and LESS
To compile Less files into CSS, we need to install Node.js, Node Package Manager (npm), and the npm LESS package to run the compilation script.
First, we’ll install Node.js. By navigating to https://nodejs.org/en in your web browser, you can find the download links for the Node.js installation package for your operating system, as illustrated in the following screenshot:
Figure 11.1 – NodeJS home page with a download link
After installing Node.js and npm, open your Terminal window (or Command Prompt on Windows). At the prompt, run the node -v
and npm -v
command. Both commands should return a version number, as illustrated in the following figure: