Skip to content
This repository has been archived by the owner on Jan 6, 2018. It is now read-only.

should be post processor not pre processor #33

Closed
JazzMaster opened this issue Jun 16, 2017 · 2 comments
Closed

should be post processor not pre processor #33

JazzMaster opened this issue Jun 16, 2017 · 2 comments

Comments

@JazzMaster
Copy link

There is a glitch here in the sequence of events that causes site text compression when used as-is.

If done properly then there is no need for ruby to cleanup the extra spaces but as-is, we are taking out potential br and paragraph codes as a preprocessor, when in post these would be just extra spaces in the html output. I have a ruby script that removes those and cleans up the html. It doesnt minify however.

--
desc "cleans up empty lines"
task :cleanup do
Dir['_site/**/*.html'].each do |file|
file_to_strip = IO.readlines(file)
fout = File.open("temp.html", "w")
in_code_block = false
file_to_strip.each do |line|
if line.include?("") or line.include?("

")
in_code_block = true
end
if (not in_code_block and not line.strip.empty?) or in_code_block
fout << line
end
if line.include?("
") or line.include?("
")
in_code_block = false
end
end
fout.close
File.rename("temp.html", file)
end
end

@JazzMaster
Copy link
Author

that didnt work. one sec.

rakefile.txt

@stereobooster
Copy link
Owner

project is deprecated #35

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants