Skip to content

Instantly share code, notes, and snippets.

@foysavas
Forked from radamant/haml_converter.rb
Created February 29, 2012 17:45
Show Gist options
  • Save foysavas/1942866 to your computer and use it in GitHub Desktop.
Save foysavas/1942866 to your computer and use it in GitHub Desktop.
Haml, Sass, and Scss conversion for 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
attr_accessor :sass_style
def matches(ext)
if ext =~ /sass/i
@sass_syntax = :sass
elsif ext =~ /scss/i
@sass_syntax = :scss
else
false
end
end
def output_ext(ext)
".css"
end
def convert(content)
engine = Sass::Engine.new(content, :syntax => @sass_syntax)
engine.render
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment