less 安装


LESS CSS can be used without compiling via less.js (sends compiled CSS directly to the DOM), and can watch your LESS file for changes, automatically updating your project. I use LESS.js and LESSC via Node in almost every PSD to HTML project I receive, and it’s a huge time saver.

There are a variety of languages and compilers for LESS, but I prefer the simplicity of LESSC on Node. It’s easy to install and more current than the LESS gem for Rails.

Installing is easy, simply follow the below steps and you’ll be running in no time.

First we need Node:

 sudo apt-get update
 sudo apt-get install git-core curl build-essential openssl libssl-dev
 git clone https://github.com/joyent/node.git
 cd node
 ./configure
 make
 sudo make install
 node -v
Now let’s get NPM (which we’ll use to install LESS)
 curl http://npmjs.org/install.sh | sudo sh
 npm -v

And now LESS

 npm install less

Finally, we’ll need to update our PATH to LESS

 gedit ~/.bashrc

and add the line

 PATH=$PATH:$HOME/node_modules/less/bin

now save your bash file and reload

 source ~/.bashrc

And that’s it. You should now be able to invoke LESS from the terminal window like so:

 lessc LESSFILE.less > CSSFILE.css

(if you receive an error running LESSC you will need to correct the path to LESS. Locate the less/bin directory inside your node modules folder, and replace the path relative to the home directory eg (PATH=$PATH:$HOME/your/node/modules/less/bin) in bash.rc and reload)

posted @ 2012-10-08 20:21  Mingxx  阅读(368)  评论(0)    收藏  举报