X-Git-Url: https://git.draconx.ca/gitweb/homepage.git/blobdiff_plain/e568824ea21f983841b8ab9e2afbcf0c57573f0b..6eafcf5e8667fd376e66e1662f44ceeacde54a74:/Rules diff --git a/Rules b/Rules index e81b5e2..79dc5f4 100644 --- a/Rules +++ b/Rules @@ -31,6 +31,23 @@ 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'