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
Hi! I’m NIklas Nilsson. I’m a consultant team leader and software engineer.
I’m interested in finding better ways to build maintainable software in small and efficient teams.
This is my personal blog about development, leadership, life and fitness.