Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about python (old posts, page 94)

Nicoletta: Nikola's little sister

Last night I saw this post by James Hard­ing ex­plain­ing how to make a sim­ple stat­ic blog us­ing Flask.

It got me think­ing... how hard would it be, and how much code would it take, to write the same func­tion­al­i­ty with as few de­pen­den­cies as pos­si­ble?

So, in­stead of break­fast and lunch I got a cof­fee and a sand­wich, and you guys get Nico­let­ta a min­i­mal­is­tic stat­ic blog gen­er­a­tor.

The de­pen­den­cies are:

And how much code was it? I had guessed 25 lines, and was off by a lot, it's 40. I could cheat a lit­tle and bring it down to 25, but hey, what's the point?

The code is up at github and should be self ex­plana­to­ry. If it's not, just ask here in the com­ments.

Nikola 6.0.0 released

Fi­nal­ly! This took a while be­cause there was a lot of work done, but re­lease 6.0.0 of Niko­la my stat­ic site and blog gen­er­a­tor is out.

De­tail­s, files, etc at github

I have tried, for this re­lease, to do things bet­ter, be more care­ful and doc­u­ment as much as pos­si­ble, as well as tried to hit most things that were hard to fix in a sin­gle back­wards in­com­pat­i­ble break.

Some of the new fea­tures are de­scribed in a se­ries of blog post­s: 1 2 3 4 5

Al­so: brand new mod­ern themes site: http://themes.get­niko­la.­com and new do­main http://get­niko­la.­com among many oth­er tweak­s.

Have fun!

Magic Mystery Forum Revisited

A long time ago I wrote a hack­ish min­i­mal­is­tic fo­rum soft­ware, which used Dis­qus as a back­end. Just to see if it still worked af­ter 2.5 years, I took a look... and it sort of did.

So, since I know much more about web­sites now than I did back then, I cleaned it up a lit­tle and de­ployed it at http://­fo­rum.ralsi­na.me

Most­ly, what I have learned in those 2.5 years is that boot­strap and JQuery are cool, and here is the be­fore/after im­age so you can see why.

And yes, it's still 32 lines of code. I re­moved a com­ment be­cause Dis­qus works bet­ter now and the rest is all tem­plate changes, done us­ing http://­jet­strap.­com

/galleries/random/before-after.thumbnail.png

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.

New in Nikola v6 part IV: Awesome Auto Mode

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: Auto Mode

Niko­la has had, since day one, a way to run in "au­to mod­e". That means that it would re­build the site au­to­mat­i­cal­ly when it saw a file change. That was pro­vid­ed by doit the cool soft­ware that han­dles niko­la's task tree.

The prob­lem was that it was slight­ly lim­it­ed, and it did­n't no­tice con­fig­u­ra­tion changes, or when you added new files. It on­ly re­act­ed to changes in things it al­ready knew as de­pen­den­cies.

Well, in v6, Niko­la has a new au­to mode cour­tesy of Python Livereload that fix­es all that.

I think the best way to show it is with a video, so here it is (there are ty­pos and such, just see the big pic­ture ;-):


Contents © 2000-2020 Roberto Alsina