harp by Brock Whitten is a zero-configuration static web server with built in pre-processing. harp server can serve Jade, Markdown, EJS, Less, Stylus, Sass, and CoffeeScript as HTML, CSS, and JavaScript without any configuration. It supports the beloved layout/partial paradigm and it has flexible metadata and global objects for traversing the file system and injecting custom data into templates. Optionally, Harp can also compile your project down to static assets for hosting behind any valid HTTP server.
Installing harp however is no different than any other Node.js module.
npm install harp
Usage
The idea behind harp is that any file in your project folder will be served as either HTML, CSS and images or JavaScript. Using proper file extensions you can signal which pre-processor you want to use for any given file. Have a look at the runnable example which is also available in a github repository. It has the following file structure:
js
index.coffee
404.jade
LICENSE
README.md
_data.json
_layout.jade
index.jade
main.less
When you start a harp server with harp server
command, you will be presented with the following simple example:
Features
Here’s the awesome stuff about harp:
- Fantastic documentation
- Support for layouts and partials
- Data pluggable from a simple JSON file
- Basic authentication
- Can compile down to flat HTML
What Else?
Checkout the runnable example and github example repository. What’s your favorite static site generator?