Created
April 16, 2012 13:04
-
-
Save pattex/2398659 to your computer and use it in GitHub Desktop.
Use Jekyll with haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! 5 | |
%html | |
%head | |
%title | |
= site.title | |
%body | |
= content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
require 'haml' | |
class Layout | |
alias_method :_original_initialize, :initialize | |
def initialize(*args) | |
_original_initialize(*args) | |
self.transform | |
end | |
end | |
class HamlConverter < Converter | |
safe true | |
priority :low | |
def matches(ext) | |
ext =~ /haml/i | |
end | |
def output_ext(ext) | |
'.html' | |
end | |
def convert(content) | |
Haml::Engine.new(content).render | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment