Created
August 18, 2011 16:35
-
-
Save destroytoday/1154475 to your computer and use it in GitHub Desktop.
Tidies all html files in the site dir
This file contains hidden or 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 'rubygems' | |
require 'tidy_ffi' | |
desc "Tidies HTML files" | |
task :tidy do | |
Dir.glob('site/**/*.html') do |path| | |
content = File.open(path).read | |
File.open(path, 'w') {|file| | |
file.write TidyFFI::Tidy.new(content, :numeric_entities => 1, :output_html => 1, :merge_divs => 0, :merge_spans => 0, :join_styles => 0, :clean => 1, :indent => 1, :wrap => 0, :drop_empty_paras => 0, :literal_attributes => 1).clean | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment