Sha256: a6ba470730f704b0d2d32f2d5e6f9dea12d487ab1547c443b2d126df2596c7fe
Contents?: true
Size: 926 Bytes
Versions: 4
Compression:
Stored size: 926 Bytes
Contents
# Frozen-string-literal: true # Copyright: 2017 - 2018 - MIT License # Author: Jordon Bedwell # Encoding: utf-8 module Jekyll module Assets module Compressors class Uglify < Sprockets::UglifierCompressor def call(input) out = super(input) Hook.trigger :asset, :after_compression do |h| h.call(input, out, "application/javascript") end out end end # rubocop:disable Metrics/LineLength Sprockets.register_compressor "application/javascript", :assets_uglify, Uglify Hook.register :env, :after_init, priority: 3 do |e| enable = e.asset_config[:compression] config = e.asset_config[:compressors][:uglifier].symbolize_keys e.js_compressor = nil if enable && Utils.javascript? && Utils.activate("uglifier") e.js_compressor = Uglify.new(config) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems