Getting started with Middleman

WordPress and other CMS’ like it have taught us well that not every site needs to be dynamic. In fact, it can be hell on the server. So, just about every decent coder out there has taken a stab at making a static site generator.

This is a good thing. If they keep this up, we may one day have one that’s user-friendly. For now, they are decidedly developer-centric, and somewhat experimental. At this stage, they are fascinating.

Today’s offering is the appropriately named Middleman, and it’s built with Ruby. Like others of its kind, you’ll need to be familiar with the command line to get it up and going. But hey, you’re reading DeveloperDrive, so that’s probably not an issue.

Features

If you’ve looked at any other site generators, or developer-friendly CMS’, the features will look fairly standard. You’ve got your layouts, and your partials. You’ve got simple configuration files, helper methods, support for simple dynamic pages, and more.

It looks like this system aims to have a few standard features, and leverage as many of Ruby’s default features and functions as possible. Templates, for example, are written as ERB (Embedded Ruby) files. Since Ruby prides itself on simplicity and speed, this is an efficient approach.

One thing that stands out is that Middleman has multiple language support out of the box. No plugins needed. Just edit your configuration files, and go.

Middleman’s biggest “feature” is its extensibility. There is already a wide range of extensions and project templates available, many of which can be installed as Ruby Gems. This includes the official blogging plugin.

Project templates

Project templates aren’t just aesthetic add-ons. Well, some of them are. Others include frameworks, third-party libraries, and custom code designed for complex projects.

Here are some noteworthy templates:

It should be noted that more than a few of the templates are starter templates with the creator’s preferred libraries pre-installed. Check them all out here.

Extensions

With the somewhat bare-bones nature of Middleman, there is a lot of room for extending the functionality in any way you like. There are extensions that improve the tools that Middleman gives you, extensions for deployment, optimization, email, configuration, and more.

I previously mentioned the official blog extension, but there are three more made by the original devs:

Some great community-made extensions include:

  • bh – helper tags for Bootstrap 3 which reduce the amount of HTML that you need to write
  • Mail2FrontMatter – allows you to email blog updates to Middleman
  • middleman-blog-drafts – adds a “draft” status for blog posts
  • middleman-search – adds a simple search engine to your site

Conclusion

For those developers who favor Ruby, and want a fairly easy way to generate a static site, Middleman is your… uh… man. With lots of community support, tons of extensions, and pretty good documentation, it’s not too hard to get started.

Ezequiel Bruni is a web/UX designer, blogger, and aspiring photographer living in Mexico. When he's not up to his finely-chiselled ears in wire-frames and front-end code, or ranting about the same, he indulges in beer, pizza, fantasy novels, and stand-up comedy. More articles by Ezequiel Bruni
Home CSS Deals DesignBombs HTML HTML5 JavaScript jQuery Miscellaneous Mobile MySQL News PHP Resources Security Snippet Tools Tutorial Web Development Web Services WordPress