Skip to content

Instantly share code, notes, and snippets.

@beathyate
Created April 25, 2011 17:41
Show Gist options
  • Save beathyate/940872 to your computer and use it in GitHub Desktop.
Save beathyate/940872 to your computer and use it in GitHub Desktop.
Jekyll haml layout converter
require 'haml'
require 'yaml'
task :default => :env do
Dir["#{@site_source}/_layouts/*.haml"].each do |file|
basename = File.basename(file, '.haml')
engine = Haml::Engine.new(File.read(file), :format => :html5)
File.open(File.join(@site_source, '_layouts', "#{basename}.html"), 'w') do |f|
f.write engine.render
end
end
end
task :env do
SITE_DATA = YAML.load_file("_config.yml")
@site_source = SITE_DATA['source']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment