FREN

#FF00AA


11 fév. 2010

“LESS.app For Mac OS X”

This. Is. Magical.

If you don’t know what Less is (I didn’t — or I must have heard about it once and promptly forgotten), it’s a Ruby application descended from Heaven to let you write parametric CSS files.

You can set up variables (e.g., color values) in the beginning of your file, reference them everywhere and only have to change the value once when you want to update the look of your entire site. You can do some math on those values (e.g., dimmer or brighter variations of those colors for some elements). You can create helper classes to include into the definition of other classes (e.g., cross-browser shadows or rounded corners), and they can even behave like functions (e.g., take the corner radius as a parameter). More info on lesscss.org.

It becomes annoying, though, in that every time you edit your CSS you have to run the file through a compiler — you can’t just upload the parametric CSS as is, you have to turn it into a regular .css file (at least as far as I know; maybe there is, or will be someday, an Apache plugin or whatever). Nobody wants to have to bother with that, and that’s where this excellent new app comes in: just give it a list of folders containing your .less files, and it will watch them and compile them into .css files every time they’re updated. There you go, .css files ready to be uploaded. (For now, the Less app doesn’t automatically send the compiled files to your FTP program, but the developer assures me that’s coming.)

If you’ve ever maintained somewhat complex CSS files, you know you want this.

 

A hint: if you want to install the Less compiler on Leopard (the application doesn’t install it by itself, for some reason), you’re going to need one more command-line instruction than documented on lesscss.org.

sudo gem update −−system

sudo gem install less

Also, the compiler can be a little picky about the CSS it wants to compile. For instance, having a comma-separated list of CSS selectors, with some of them commented out, will throw a syntax error. Just work around it.

Vous voulez savoir quand je poste du contenu sur mon blog ? Il suffit de vous inscrire gratuitement à un agrégateur RSS (Feedly, NewsBlur, Inoreader, …) et d'ajouter www.ff00aa.com à vos flux (ou www.garoo.net pour vous abonner à tous les sujets). On n'a pas besoin de newsletters, pas besoin de Twitter, le RSS existe toujours.

Mentions légales : ce blog est hébergé par OVH, 2 rue Kellermann, 59100 Roubaix, France, www.ovhcloud.com.

Les données des visiteurs de ce blog ne sont pas utilisées ni transmises à des tiers. Les posteurs de commentaires peuvent demander leur suppression par e-mail.

Tous contenus © de l'auteur ou couverts par le droit de citation.