donderdag 11 februari 2016

Jekyll, what is it?

Jekyll calls itself "A blog aware static site builder".

OK, so what is a blog aware static site builder?

To be honest I am not quite sure about the "blog aware" yet. But the static site builder is something I can wrap my head around. The main idea is that Jekyll is a transformation engine that takes some input files, processes them, and then spits out the (static) files for the website.

Why "static"?, well because there is no interpreter running on the server to process the files before they are sent on their way to the requesting browser. This makes the site fast. No, it makes the site VERY FAST. My old mac mini that I use as a web server did take its own sweet time in serving up PHP Wordpress content. But serving up the pages from a static site is near instantaneous. Very fast indeed!

But, what with dynamic content? Well, dynamic is overrated... no kidding. Yes some websites must be dynamic. But it turns out we can do an awful lot with static websites that include dynamic functionality from third parties. Often for free. So if we want users to be able to comment on our blogs, that is not really a problem. Just find a suitable service provider. I would hazard a guess that most private users and even small companies (that don't do web-based-business) can do just fine with a static website.

Back to Jekyll. So it processes input files. What input files?

This did take me some time to figure out. I thought that it would take some CSS files, some HTML files and then spit out the site. But I was thinking way... to simplistic. Yes, Jekyll is more than a simple merging of CSS and HTML files. It can do some real transformation along the way. So far I have discovered the following types of transformation.

1) It transforms files written in a Markdown flavour (I use Kramdown) to HTML pages. This is very handy when creating content. It is much quicker to create a post or page in Markdown than it is to create the corresponding HTML. The downside is that you have to learn the Markdown syntax, but that is rather easy, and it does take out the headache of writing every post or page in HTML.

2) It creates CSS from SCSS. If you are a web developer you are already familiar with SASS/SCSS. For us programmers, SASS or SCSS is a way better method to write CSS than CSS itself. It has familiarities with object oriented programming. I find it actually easier to learn CSS via SCSS than learning SCC in itself. But yes, it does mean that you have to learn SCSS as well.

3) It processes layout specifications written in a mix of HTML and Liquid to produce the static HTML pages. Liquid looks like a programming language. It has control statements, loop statements, formatting filters, variables etc. As a programmer it is easy to learn.

Workflow

The complete workflow (assuming the site template is ready) is as follows:

Add a post or page written in Markdown to the site, run the Jekyll build command, copy the generated files to the web server, and ... well nothing. That is all there is. The site has just been updated.

So that was easy. You must provide the editor to create the new post cq page. A plain text editor with syntax colouring for CSS/HTML like TextWrangler or BBEdit comes in handy. Also it is necessary to use the command line in the Terminal. That may feel unfamiliar at first but is no real deal breaker.

Site Template

Building the site template is a little more difficult. This is where real sweat is necessary. IMO it is necessary to be somewhat of a programmer to really love this kind of work. If you are unfamiliar with programming, CSS and HTML (and possibly Javascript) then Jekyll may not be your thing.

But I will write more about this as it is the subject of this blog. More to come...

Disclaimer

Please remember that I am just a (novice) Jekyll user. Any insights that I have I have from using Jekyll. What I write helps me in understanding the tool, but may be incomplete or even wrong in the eye's of the Jekyll developers.

Geen opmerkingen:

Een reactie posten