X-Git-Url: http://git.draconx.ca/gitweb/homepage.git/blobdiff_plain/da4a13ce4868f32787813c76898cc9b39dec1bcc..b6d30bd05c54078bbf60e7242aabff21ed4492da:/Rules diff --git a/Rules b/Rules index 06f3a11..79dc5f4 100644 --- a/Rules +++ b/Rules @@ -31,11 +31,29 @@ preprocess do end end +postprocess do + # Gzip all text items for nginx http_static + if !ENV['GZIP_SITE'].to_s.empty? + reps = @items.flat_map(&:reps).each do |rep| + file = rep.raw_path + next if !file or rep.binary? + + if system("gzip", "-ck9", file, [:out]=>[file + ".gz.tmp", "wb"]) + system("touch", "-r", file, file + ".gz.tmp") + File.rename(file + ".gz.tmp", file + ".gz") + else + File.unlink(file + ".gz.tmp") + end + end + end +end + compile '/**/*.md' do filter :kramdown, header_offset: 1 layout '/default.xml' layout '/default.xsl' filter :relativize_paths, type: :xml + filter :remove_wj write to_xhtml end @@ -45,6 +63,7 @@ compile '/license/cc*.sgml' do layout '/default.xml' layout '/default.xsl' filter :relativize_paths, type: :xml + filter :remove_wj write to_xhtml end @@ -53,6 +72,7 @@ compile '/license/cc*.xhtml' do layout '/default.xml' layout '/default.xsl' filter :relativize_paths, type: :xml + filter :remove_wj write to_xhtml end