Sha256: d87e9451be3f5e35d19bf0fc0e7084954968c03d5835dafad1bf805e7dee93e4
Contents?: true
Size: 853 Bytes
Versions: 2
Compression:
Stored size: 853 Bytes
Contents
# frozen_string_literal: true require 'jekyll/brotli/version' require 'jekyll/brotli/config' require 'jekyll/brotli/compressor' require 'pathname' module Jekyll module Brotli end end Jekyll::Hooks.register :site, :post_write do |site| Jekyll::Brotli::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? '.br' 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::Brotli::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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jekyll-brotli-2.4.0 | lib/jekyll/brotli.rb |
jekyll-brotli-2.3.0 | lib/jekyll/brotli.rb |