Small snippet to compress HTML in Ruby. Returning from function is a string with the basic compressed HTML.
def compress(html)
html.gsub!(/\n+/,'')
html.gsub!(' ', '')
html.gsub!('> <', '><')
puts html
end
Posted: December 24, 2022
Small snippet to compress HTML in Ruby. Returning from function is a string with the basic compressed HTML.
def compress(html)
html.gsub!(/\n+/,'')
html.gsub!(' ', '')
html.gsub!('> <', '><')
puts html
end