How to compile lesscss using node.js

梦想与她 提交于 2019-12-05 16:37:46
ItalyPaleAle

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.

it's not mentioned what to do after installing node.js and installing less compiler on your node.

Go to your folder where you are hosting your project locally and then type styles. less styles.css. This should initiate the conversion from less to CSS at the node command prompt.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!