Last active
October 21, 2016 05:42
-
-
Save jteneycke/4cabb142035fb71d74ce6ef4bb0cf2b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "pry" | |
def command?(name) | |
`which #{name}` | |
$?.success? | |
end | |
htmls = `find . -type f -name \*.html`.split("\n") | |
erbs = `find . -type f -name \*.html.erb`.split("\n") | |
files = htmls + erbs | |
if command?("html2haml") | |
puts "yes" | |
files.each do |file| | |
new_extension = file.gsub(/(html|html.erb)$/, "haml") | |
`html2haml #{file} > #{new_extension}` | |
`rm #{file}` | |
puts "Converting and removing #{file.split("/").last}" | |
end | |
else | |
puts "No binary for html2haml. Please install it by pasting:" | |
puts "gem install html2haml" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment