Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2010 16:34
  • Star 14 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
HAML plugin for jekyll
# _plugins/haml_converter.rb
module Jekyll
class HamlConverter < Converter
safe true
def setup
return if @setup
require 'haml'
@setup = true
STDERR.puts 'do `gem install haml`'
raise"Missing dependency: haml")
def matches(ext)
ext =~ /haml/i
def output_ext(ext)
def convert(content)
engine =
<!-- _layouts/home.haml -->
%title= page.title
#header HEADER
= content
#footer FOOTER
layout: home
title: Home Page
%h1 Hello World?
Copy link

will this work with github pages?

Copy link

dtjm commented Jun 2, 2011

I don't think so. There is an open ticket here: jekyll/jekyll#53

For now, you'll have to pre-process your Haml before sending it to Github pages. This is not too bad if you can set up your development environment to automatically compile the HAML whenever you save.

Copy link

How are you pre-processing the HAML?

Copy link

see line 24 onwards

Copy link

dtjm commented Jun 27, 2011

@bcardarella Since haml doesn't have a --watch option like SASS, you could use also try using the unix watch command. Maybe something like this: watch haml *.haml (Sorry I haven't tried it and I don't have any of my code in front of me right now)

Copy link

jfrux commented Nov 4, 2013

Does home.haml actually work? I can't seem to get my layout to generate correctly with haml?

Copy link

This plguin isn't converting my haml layouts to html

But it works for the content pages, any ideas?

Copy link

jalcine commented Aug 29, 2014

@topher6345 what's the suffix of your layout files? Might wanna make them .html to make the plugin pick them up.

Copy link

2xG commented Apr 29, 2015

I have an error with new version of haml gem. says that markup filters have been moved to separate gem 'haml-contrib'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment