LESS CSS preprocessor

Events happening in the community are now at Drupal community events on www.drupal.org.
mossy2100's picture

Just sharing this as I think it's fantastic and I only just discovered it. LESS is a CSS preprocessor that allow you to put variables and single-line comments in your CSS. If you do a lot of CSS like me, you'll know what an incredibly useful feature this would be. Something I've been waiting for, and I won't be surprised if it eventually becomes part of the CSS spec.

Anyway - some links:
http://www.sitepoint.com/a-comprehensive-introduction-to-less/

Is there a module? You bet:
http://drupal.org/project/less

Mossy

Comments

LESS is fantastic

watbe's picture

I only discovered LESS a few months ago, but it has helped to make my workflow so much faster. It's really fantastic and the overhead is minimal.

Have to seen SASS?

8thom's picture

Hey Mossy,

I understand it's along the same line's but have you looked into the SASS/sassy module?

http://drupal.org/project/sassy

Not too sure if LESS can but SASS will allow these "new" CSS variables to be fetched from Drupal's DB which opens the door to huge potential.

Here's a recent podcast with the module maintainer - http://modulesunraveled.com/podcast/011-rich-lyon-and-bringing-sass-to-d...

There's was also a Drupalcon session on it - http://denver2012.drupal.org/program/sessions/using-sass-compass-drupal-...

It would be nice if it could be integrated into browsers so it didn't need the be complied.

LESS can run client side.

queenvictoria's picture

@8thom one of the advantages (though they are very similar) that LESS hass over SASS is that it has a javascript compiler so that it can run client side in the browser. The downside of that would be the time it takes slower machines with larger LESS files to process.
http://lesscss.org/#-client-side-usage

It also has a server-side NodeJS compiler.
http://lesscss.org/#-server-side-usage

[edit] Here is a patch that brings in some LESS variables from the dot info file and theme-settings (database).
http://drupal.org/node/1433948

I guess what you really mean is why can't CSS handle this kind of operation?

SASS = the business

mossy2100's picture

Looks awesome, 8thom - much better than LESS! Love the idea of nested styles, mixins and formulas!

CSS preprocessor in core

dozymoe's picture

There's a core issue to add a CSS preprocessor to core. That issue is geared towards adding sass apparently, probably should be renamed as such.

@mossy2100 Less also has

queenvictoria's picture

@mossy2100 Less also has mixins, operations and nested styles. Less and sass are pretty much tracking one another. Very little to tell between them at the moment. There are some good comparison matrices around if you're interesed.

compare

mossy2100's picture

Here's one comparison:
https://gist.github.com/674726

It seems SCSS is marginally better, although there's not a lot of difference.

I find scss easier to read

queenvictoria's picture

I find scss easier to read but less easier for development.

I chose LESS

mossy2100's picture

I decided to go with LESS for the following reasons:
- Usage statistics for the respective modules (about 2500 for less, 160 for sass) i.e. wisdom of crowds.
- I think it handles variable scoping more correctly, although this is debatable.
- It has a better/simpler/more usfeul syntax for mixins and extend.

Having said that, I really like SCSS's programming-style constructs such as if, else, for, each, while and function. Also it's a pain to google for information about LESS because it's a non-distinctive keyword. I will try LESS for now and see how they both evolve.

More links if interested:
http://coding.smashingmagazine.com/2011/09/09/an-introduction-to-less-an...
http://nex-3.com/posts/83-sass-and-less

post deleted, too late ;)

OxideInteractive's picture

post deleted, too late ;)

not necessarily

mossy2100's picture

I have implemented LESS in one project, with success. I like it very much. However, I have continued my experimentation and now I am leaning more towards SCSS; and it seems that many others do as well. Aside from the greater number of features offered by SCSS, there's also this wonderful thing called Compass built on top of it, which provides some very useful pre-built mixins. I'm currently assembling (or, trying to) a new HTML5 theme that combines Omega, HTML5 tools, Compass, SCSS and PIE. I would definitely be interested in learning more about More (so to speak).

Want to hear how that goes!!!

dshumaker's picture

Hi Mossy,

I definitely want to here how your "Omega, HTML5 tools, Compass, SCSS and PIE" project goes. I'm working on something similar.

-d

Australia

Group categories

Location

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: