Outils pour utilisateurs

Outils du site


devweb:less (lu 3748 fois)

LESS

Homepage ⇒ http://lesscss.org/

Installation

Méthode la plus simple

apt-get install node-less

Méthode plus longue...

# être root

su root
cd ~

# Download latest version of node.js
# please replace the url with the newest available version, which you can find here http://nodejs.org/download/

wget http://nodejs.org/dist/node-v0.4.7.tar.gz

# extract node.js install package

tar xfvz node-v0.4.7.tar.gz

# change working directory

cd node-v0.4.7

# configure

./configure

# compile it

make -j4

# install it

make install

Installer less

npm install -g less
When you run “./configure” you might get an error that no g++,c++… compiler is available.
You can run “apt-get install build-essential” to solve this.

If you get an error that no openSSL is not available you can either configure it without them (–without-ssl) or you can install libssl by running: apt-get install libssl-dev

Utilisation

Command-line usage

Once installed, you can invoke the compiler from the command-line, as such:

$ lessc styles.less

This will output the compiled CSS to stdout, you may then redirect it to a file of your choice:

$ lessc styles.less > styles.css

Pour minifier le code, il faut installer YUI Compressor

$ aptitude install yui-compressor

To output minified CSS, simply pass the -x option. If you would like more involved minification, the YUI CSS Compressor is also available with the –yui-compress option.

To see all the command line options run lessc without parameters.

Un petit script pour automatiser tout ça

#!/bin/bash
cd `dirname $0`
lessc --yui-compress public/less/bootstrap.less > public/css/bootstrap.min.css

Mixins library

http://lesselements.com/

To use:
Download the “elements.less” file.
Place it in the same folder with your other LESS files.
Reference it at the top of your LESS stylesheets with:

@import "elements.less";

https://github.com/madebysource/lesshat/blob/master/README.md

devweb/less.txt · Dernière modification: 08-02-2015 22:29 de edmc73