Skip to content

Instantly share code, notes, and snippets.

@patorash
Created February 18, 2013 06:02
Show Gist options
  • Save patorash/4975372 to your computer and use it in GitHub Desktop.
Save patorash/4975372 to your computer and use it in GitHub Desktop.
# coding: utf-8
require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
require 'erb2slim'
namespace :convert do
desc "Convert slim from erb"
task :erb2slim do
Dir::glob("#{Rails.root}/app/views/**/*.html.erb").each do |f|
open(f, 'r') {|file|
slim_string = Erb2Slim.convert(file.read)
File.open(f.sub(/\.erb$/, ".slim"), "w") {|file2|
file2.write(slim_string)
}
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment