Sha256: dded315aff41d392f484007c60cd64f3e5a55a9b565eb2c414c3bbcdd5240acb
Contents?: true
Size: 1008 Bytes
Versions: 4
Compression:
Stored size: 1008 Bytes
Contents
# frozen_string_literal: true require 'jekyll/gzip/version' require 'jekyll/gzip/config' require 'jekyll/gzip/compressor' require 'pathname' module Jekyll module Gzip end end Jekyll::Hooks.register :site, :after_init do |site| config = site.config['gzip'] || {} site.config['gzip'] = Jekyll::Gzip::DEFAULT_CONFIG.merge(config) || {} end Jekyll::Hooks.register :site, :post_write do |site| Jekyll::Gzip::Compressor.compress_site(site) if Jekyll.env == 'production' end Jekyll::Hooks.register :clean, :on_obsolete do |obsolete| obsolete.delete_if do |path| path.end_with? '.gz' end end begin require 'jekyll-assets' Jekyll::Assets::Hook.register :env, :after_write do |env| if Jekyll.env == 'production' path = Pathname.new("#{env.jekyll.config['destination']}#{env.prefix_url}") Jekyll::Gzip::Compressor.compress_directory(path, env.jekyll) end end rescue LoadError # The Jekyll site doesn't use Jekyll::Assets, so no need to compress those # files. end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jekyll-gzip-2.5.0 | lib/jekyll/gzip.rb |
jekyll-gzip-2.4.2 | lib/jekyll/gzip.rb |
jekyll-gzip-2.4.1 | lib/jekyll/gzip.rb |
jekyll-gzip-2.4.0 | lib/jekyll/gzip.rb |