Skip to content

Instantly share code, notes, and snippets.

View assafgelber's full-sized avatar

Assaf Gelber assafgelber

View GitHub Profile
@assafgelber
assafgelber / Rakefile
Last active December 19, 2015 15:38
Rakefile for building haml layouts, includes and indexes for jekyll for use in github pages.
# Rake tasks to parse haml layouts, includes and index files for jekyll
# Assumes that the haml files are in (_layouts|_includes|_posts)/_haml
namespace :haml do
require 'haml'
def convert file, destination
base_name = File.basename(file, '.haml') + '.html'
html = File.open(file, 'r') { |f| Haml::Engine.new(f.read).render }
File.open(File.join(destination, base_name), 'w') { |f| f.write html }