Skip to content

Commit 860b8b9

Browse files
committed
Merge pull request #20 from pathawks/minify-once
Minify template just once
2 parents 6602491 + 7a55460 commit 860b8b9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/jekyll-seo-tag.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ def render(context)
1313
@context = context
1414
output = Liquid::Template.parse(template_contents).render!(payload, info)
1515

16-
# Minify
17-
output.gsub!(/[\s]{2,}/, "\n")
18-
1916
# Encode smart quotes. See https://github.com/benbalter/jekyll-seo-tag/pull/6
2017
output.gsub!(HTML_ESCAPE_REGEX, HTML_ESCAPE)
2118

@@ -39,7 +36,7 @@ def info
3936
end
4037

4138
def template_contents
42-
@template_contents ||= File.read(template_path)
39+
@template_contents ||= File.read(template_path).gsub(/(>\n|[%}]})\s+(<|{[{%])/,'\1\2').chomp
4340
end
4441

4542
def template_path

0 commit comments

Comments
 (0)