2018-05-16 22:42:07 +02:00
|
|
|
require 'htmlcompressor'
|
2020-08-26 11:44:49 +02:00
|
|
|
require 'rainpress'
|
|
|
|
require 'uglifier'
|
|
|
|
|
|
|
|
class UglifyProxy < Uglifier
|
|
|
|
alias_method :compress, :compile
|
|
|
|
end
|
|
|
|
|
|
|
|
JS_COMPRESSOR = UglifyProxy.new
|
|
|
|
CSS_COMPRESSOR = Rainpress
|
2016-12-29 13:37:22 +01:00
|
|
|
|
2018-08-28 21:59:17 +02:00
|
|
|
Nanoc::Filter.define(:html_press) do |content, options|
|
2020-08-26 11:44:49 +02:00
|
|
|
HtmlCompressor::Compressor.new(compress_javascript: true, javascript_compressor: JS_COMPRESSOR, compress_css: true, css_compressor: CSS_COMPRESSOR, remove_quotes: true, simple_boolean_attributes: true).compress content
|
2016-12-29 13:37:22 +01:00
|
|
|
end
|