In my Ruby codes I'm removing all new lines, tabs and HTML comments.
But when I do this all the codes inside <pre>
turning one line too.
module Jekyll
module HtmlCompressor
def htmlCompressor(data)
data.gsub("\n", "").gsub("\t", "").gsub(/<!--(?!<!)[^\[>].*?-->/, "")
end
end
end
Liquid::Template.register_filter(Jekyll::HtmlCompressor)
How can I modify this regex to only work outside <pre>
blocks?