Redo origin

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

View File

@ -67,11 +67,3 @@ jekyll-minifier:
harmony: true
</code></pre>
# Like my stuff?
Would you like to buy me a coffee or send me a tip?
While it's not expected, I would really appreciate it.
[![Paypal](https://www.paypalobjects.com/webstatic/mktg/Logo/pp-logo-100px.png)](https://paypal.me/MattSpurrier) <a href="https://www.buymeacoffee.com/digitalsparky" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/white_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>

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