Skip to main content

Ralsina.Me — Roberto Alsina's website

New in Nikola v6 part V: LESS is more

I am plan­ning to do a ma­jor re­lease (ver­sion 6!) of Niko­la my stat­ic blog and site gen­er­a­tor the next week­end. It's a ma­jor ver­sion be­cause there has been a ton of fea­ture work done. So, I will do a quick se­ries high­light­ing some of those im­prove­ments this week.

Today's Topic: LESS

Un­less you are hap­py with your site look­ing like straight boot­strap (and you re­al­ly should not) CSS goes a long way to­wards mak­ing your pages look just the way you want them to.

The bad part is that, if you have done any CSS you will know CSS is a re­al­ly, re­al­ly crap­py "lan­guage". That's why a whole philum of tools has been cre­at­ed that take a more pow­er­ful syn­tax and out­put CSS.

Niko­la now has sup­port for one of the­se, called LESS (although adding sup­port for oth­ers like SASS should be very easy).

So, how does it work?

  1. In your the­me, put LESS files in the less/ fold­er.

  2. Cre­ate less/­tar­gets and put there the files that should be com­piled us­ing lessc, one per line.

  3. There is no step 3

Nikola will automatically build output/assets/css/foo.css out of theme/foo/less/foo.less and will even support the usual theme inheritance, so if there ever is a LESS-based theme out there, you can just tweaks the files you want.

I per­son­al­ly am not writ­ing that hy­po­thet­i­cal LESS-based the­me, but I am more than ready to help who­ev­er wants to do one.

Brandon Rhodes / 2013-09-03 06:04:

In case people ask me about how, exactly, to choose between them: how did you decide on LESS?

ralsina / 2013-09-03 12:55:

well, the default theme is bootstrap-based, and bootstrap is less-based so it was mostly "by default" :-)

Contents © 2000-2024 Roberto Alsina