Redo origin

This commit is contained in:
2023-11-19 11:06:03 +01:00
parent 77e68a05a2
commit 11bd9c2c4d
3 changed files with 19 additions and 10 deletions

View File

@ -34,6 +34,7 @@ module Jekyll
end
def output_html(path, content)
if ( ENV['JEKYLL_ENV'] == "production" )
html_args = { remove_comments: true, compress_css: true, compress_javascript: true, preserve_patterns: [] }
js_args = {}
@ -63,7 +64,7 @@ module Jekyll
html_args[:simple_boolean_attributes] = opts['simple_boolean_attributes'] if opts.has_key?('simple_boolean_attributes')
html_args[:compress_js_templates] = opts['compress_js_templates'] if opts.has_key?('compress_js_templates')
html_args[:preserve_patterns] += [/<\?php.*?\?>/im] if opts['preserve_php'] == true
html_args[:preserve_patterns] += opts['preserve_patterns'].map { |pattern| Regexp.new(pattern)} if opts.has_key?('preserve_patterns')
html_args[:preserve_patterns] += opts[:preserve_patterns].map { |pattern| Regexp.new(pattern)} if opts.has_key?(:preserve_patterns)
end
html_args[:css_compressor] = CSSminify2.new()
@ -76,9 +77,13 @@ module Jekyll
compressor = HtmlCompressor::Compressor.new(html_args)
output_file(path, compressor.compress(content))
else
output_file(path, content)
end
end
def output_js(path, content)
if ( ENV['JEKYLL_ENV'] == "production" )
js_args = {}
opts = @site.config['jekyll-minifier']
compress = true
@ -98,9 +103,13 @@ module Jekyll
else
output_file(path, content)
end
else
output_file(path, content)
end
end
def output_json(path, content)
if ( ENV['JEKYLL_ENV'] == "production" )
opts = @site.config['jekyll-minifier']
compress = true
if ( !opts.nil? )
@ -112,9 +121,13 @@ module Jekyll
else
output_file(path, content)
end
else
output_file(path, content)
end
end
def output_css(path, content)
if ( ENV['JEKYLL_ENV'] == "production" )
opts = @site.config['jekyll-minifier']
compress = true
if ( !opts.nil? )
@ -126,6 +139,9 @@ module Jekyll
else
output_file(path, content)
end
else
output_file(path, content)
end
end

View File

@ -1,5 +1,6 @@
module Jekyll
module Minifier
VERSION = "0.1.8"
#VERSION = "0.1.8"
VERSION = "0.1.11"
end
end