如何使用node.js编译lesscss [英] How to compile lesscss using node.js
问题描述
我已经完成了使用lesscss
客户端对我的网站进行编码的工作,现在想编译less
,因此我已经下载了node.js
.我的网站在localhost上运行,我想首先知道:
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:
- 我必须安装node.js的地方
- 接下来我要做什么(命令行工具,命令行等).
如果有人可以帮助我,因为我是该领域的新手.
If someone can help me because I'm a newbie in this field.
谢谢.
推荐答案
您可以直接从npm
安装LESS编译器.
You can install the LESS compiler directly from npm
.
- 安装
node.js
.转到此页面,然后下载适合您平台的安装程序.
如果您使用的是Windows,请下载.msi
;否则,请下载.msi
.如果您使用的是OSX,请下载.pkg
文件.尽可能下载64位版本(除非您的系统仅运行32位硬件和软件).如果您使用的是Linux,并且要使用软件包管理器,请参见此页面. - 一旦安装了
node.js
,您还应该安装npm
,即node.js
Package Manager .您可以打开终端/控制台并运行npm -v
以确保所有内容均已正确安装. -
最终,您可以通过执行以下命令来安装LESS编译器:
- 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. - Once you have
node.js
installed, you should also havenpm
, which isnode.js
Package Manager. You can open a terminal/console and runnpm -v
to make sure everything is installed correctly. Eventually, you can install the LESS compiler by simply executing:
npm install -g less
(注意:在OSX和Linux上,您可能需要使用sudo运行它:sudo npm install -g less
).
(note: on OSX and Linux you may need to run this with sudo: sudo npm install -g less
).
然后,LESS编译器将作为lessc
命令可用.请参见此处的示例.
The LESS compiler will then be available as the lessc
command. See examples here.
PS:还存在一些GUI来简化lessc
的使用.谷歌更少的GUI Windows/Mac/Linux的"看到许多结果,如此Mac版.
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.
这篇关于如何使用node.js编译lesscss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!