如何使用node.js编译lesscss [英] How to compile lesscss using node.js

查看:91
本文介绍了如何使用node.js编译lesscss的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经完成了使用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:

  1. 我必须安装node.js的地方
  2. 接下来我要做什么(命令行工具,命令行等).

如果有人可以帮助我,因为我是该领域的新手.

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

谢谢.

推荐答案

您可以直接从npm安装LESS编译器.

You can install the LESS compiler directly from npm.

  1. 安装node.js.转到此页面,然后下载适合您平台的安装程序.
    如果您使用的是Windows,请下载.msi;否则,请下载.msi.如果您使用的是OSX,请下载.pkg文件.尽可能下载64位版本(除非您的系统仅运行32位硬件和软件).如果您使用的是Linux,并且要使用软件包管理器,请参见此页面.
  2. 一旦安装了node.js,您还应该安装npm,即 node.js Package Manager .您可以打开终端/控制台并运行npm -v以确保所有内容均已正确安装.
  3. 最终,您可以通过执行以下命令来安装LESS编译器:

  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

(注意:在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆