HAML and SASS converters for Jekyll
by Adam Pearson
on 2010.07.19
Since jekyll added simple plugins support in version 0.6, it is incredibly easy to add HAML and SASS support to your jekyll-powered site.
Just add the following code as _plugins/haml_converter.rb, then any .haml or .sass files will automatically be converted by jekyll.
module Jekyll
require 'haml'
class HamlConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /haml/i
end
def output_ext(ext)
".html"
end
def convert(content)
engine = Haml::Engine.new(content)
engine.render
end
end
require 'sass'
class SassConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /sass/i
end
def output_ext(ext)
".css"
end
def convert(content)
engine = Sass::Engine.new(content)
engine.render
end
end
end
Or you can download this code as a gist.
» permalink
