2015-08-30

Trying out Harp

Trying out Harp

I always wanted to start a blog. I decided it needs to be an easy to maintain static webpage. It should also support Markdown and I want to build it from ground up learning some cool stuff along the way.

My first idea was to use Yeoman to scaffold an app using gulp-webapp generator. Yo gulp-webapp! Done. Please don't get me wrong - I love gulp-webapp-generator and Yeoman, yet I wasn't happy about spending next hour on Gulpfile customization, because I am never satisfied with the defaults plus I used it in the past, so there was nothing new to learn. Also time I wanted to get to design and content as quickly as possible. I wanted less configuration, support for the new cool web stuff out-of-the-box and it would be great if it's Node.js based. And then after some more googling I found Harp. Harp among other things is a Node.js-based web server with built-in transpilers for all frontend goodies like template engines (Jade and EJS), CSS preprocessors (SCSS, LESS), Markdown, Coffescript and convention-over-configuration approach. It processes your files on the fly and serves as plain old HTML and CSS.

The 3 main Harp commands I use are init, server and compile. Using init you can scaffold an empty Harp project using the boilerplate of your choice. The server command starts the development server, which I already mentioned (serves and transpiles) and once you are done developing your website you can use the compile command to transpile and minify all your shiny project files, so you can put them on a server for people to see.

While all this automation and conventions are nice, yet I quickly missed my gulp tasks and e.g. browser-sync. But all is not lost, because the internet already thought of that - here's the gist for a Gulpfile combining browser-sync and Harp server. You can now have a Gulp accompanying your Harp setup.

To sum up, I think Harp is a great tool for beginners and people, who value the simplicity and are a bit lazy want to quickly start something skipping the misery of initial project configuration and rely more on predefined conventions. What I can say for sure it's perfect for small projects (like a static blog), but I suspect once you need some more complex work done, then you are probably going to miss Grunt/Gulp flexibility.

As this blog was created using Harp, do not forget to check out the source or try Harp on your own. There is a great developer's guide on Harp's website and some ready to use recipes like for building a blog. Go check! See ya.