Serve 1.5 – Utterly Delicious ERB, Haml and Sass

If you’ve been following my Twitter stream at all during the last month, you know that I’ve been hard at work on a project I like to call, Serve. Serve is an open source project that makes it easy to build websites with HTML, ERB, Haml + Sass.

I do a lot of HTML prototyping for Web applications. I also build a lot of brochure websites for said applications. Serve makes it easy for me to use the tools that I’ve grown to love while working with Ruby on Rails projects (ERB + Sass) to construct basic websites.

Serve is modeled a lot on Rails. If you’re a Rails programmer, you could call it just the Views part of the Rails MVC. Serve is built with Rack and Tilt, so it’s easy to use and deploy on your favorite Ruby platforms. As of 1.5 you can also export your sites as plain HTML if your Web host doesn’t support Ruby.

So how’s it work? Throw your ERB, Haml, and Sass in a directory, cd to it on the command prompt, and type:


Then browse over to http://localhost:4000 and view your website there. It’s that simple.

You can learn more about Serve on it’s brand-spanking new website. (Serve’s new website is actually made with Serve. How meta!)

So let’s dive into some of my favorite things about 1.5.

Export your site to HTML

The #1 feature request for Serve is now a reality. You can now export your sites to pure HTML. From the command line type:

serve export my-project output

Where my-project is the name of the directory for your project and output is the name of the output directory.

The export feature is new, so expect some hiccups, but it is working well enough to dogfood the Serve website. Add Rsync into the mix and Serve export and deployment really Rocks. It takes about 6 seconds to generate and deploy the Serve website (no kidding).

Better default template

One of the things I’ve been working hard on is the getting started process. I want to make it super easy to get up and running with Serve. With that in mind I’ve totally revamped the default template for structured Serve projects. Now when you generate a Serve project with:

serve create my-project

You’ll have lots of additional goodies that make getting started much easier, including:

Template support

Template support is actually new in this version of Serve, too. To create a project based on a custom template, type:

serve create -t my-template-directory my-project

Where my-template-directory is the directory where your template is stored. Serve templates are very similar to Serve projects. During the bootstrap process a small set of files (Gemfile,, etc) are copied over and then the template files are copied. (Template files will overwrite files from the bootstrap, so only include the files that are unique to your template.)

Serve includes two templates right now, default and blank. Default is used by default (duh!) when no template is specified. But a “blank” project can be generated like this:

serve create -t blank my-project

The “blank” template only contains the bootstrap files. This is useful if you want to start a project from scratch, but don’t want the cruft from the default template.

Website, mailing list, and Twitter

I’ve also launched a couple of new initiatives for Serve that I want to tell you about:

© 2013 John W. Long