Last active
December 20, 2015 11:19
-
-
Save johnagan/6122437 to your computer and use it in GitHub Desktop.
HTML2Slim
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
require 'html2slim' | |
html_path = "" | |
slim_path = "" | |
Dir.mkdir(slim_path) unless File.exists?(slim_path) | |
Dir["#{html_path}/*.html"].each do |file_name| | |
html = File.read(file_name).encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') | |
File.open("#{slim_path}/#{File.basename(file_name)}.slim", 'w') do |f| | |
f.write HTML2Slim.convert!(html, :html) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment