jekyll-minifier 0.1.10 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,127 @@
1
+ # Jekyll Minifier - Enhanced CSS Compression Configuration Example
2
+ #
3
+ # This configuration showcases the new cssminify2 v2.1.0 enhanced features
4
+ # integrated with Jekyll Minifier v0.2.1+
5
+
6
+ # Basic minification controls (existing functionality - UNCHANGED)
7
+ jekyll-minifier:
8
+ # File type compression toggles
9
+ compress_css: true # Enable/disable CSS compression
10
+ compress_javascript: true # Enable/disable JavaScript compression
11
+ compress_json: true # Enable/disable JSON compression
12
+
13
+ # File exclusions (supports glob patterns)
14
+ exclude:
15
+ - '*.min.js' # Skip already minified JavaScript
16
+ - '*.min.css' # Skip already minified CSS
17
+ - 'vendor/**/*' # Skip vendor directory
18
+ - 'node_modules/**/*' # Skip node_modules
19
+
20
+ # HTML compression options (existing functionality)
21
+ remove_comments: true # Remove HTML comments
22
+ remove_intertag_spaces: false # Remove spaces between tags
23
+ remove_multi_spaces: true # Collapse multiple spaces
24
+ compress_css: true # Compress inline CSS in HTML
25
+ compress_javascript: true # Compress inline JS in HTML
26
+
27
+ # JavaScript/Terser configuration (existing functionality)
28
+ terser_args:
29
+ compress:
30
+ drop_console: true # Remove console.log statements
31
+ mangle: true # Shorten variable names
32
+
33
+ # Security: Pattern preservation (existing functionality)
34
+ preserve_patterns:
35
+ - '<%.*?%>' # Preserve ERB/JSP patterns
36
+ - '\{\{.*?\}\}' # Preserve template patterns
37
+ preserve_php: true # Preserve PHP tags
38
+
39
+ # ==========================================
40
+ # NEW: Enhanced CSS Compression Features
41
+ # ==========================================
42
+
43
+ # Enable enhanced CSS compression mode (cssminify2 v2.1.0+)
44
+ # DEFAULT: false (maintains backward compatibility)
45
+ css_enhanced_mode: true
46
+
47
+ # Enhanced CSS compression options (only used when css_enhanced_mode: true)
48
+
49
+ # Merge duplicate CSS selectors for better compression
50
+ # Example: .btn{color:red} .btn{margin:5px} → .btn{color:red;margin:5px}
51
+ # DEFAULT: false
52
+ css_merge_duplicate_selectors: true
53
+
54
+ # Optimize CSS shorthand properties
55
+ # Example: margin-top:10px;margin-right:10px;margin-bottom:10px;margin-left:10px → margin:10px
56
+ # DEFAULT: false
57
+ css_optimize_shorthand_properties: true
58
+
59
+ # Advanced color optimization beyond standard compression
60
+ # Example: rgba(255,255,255,1.0) → #fff, rgb(0,0,0) → #000
61
+ # DEFAULT: false
62
+ css_advanced_color_optimization: true
63
+
64
+ # Preserve IE-specific CSS hacks (recommended: true for compatibility)
65
+ # Example: *zoom:1, _position:relative (IE6/7 hacks)
66
+ # DEFAULT: true
67
+ css_preserve_ie_hacks: true
68
+
69
+ # Compress CSS custom properties (variables) where safe
70
+ # Example: --primary-color optimization and usage analysis
71
+ # DEFAULT: false
72
+ css_compress_variables: false
73
+
74
+ # ==========================================
75
+ # Configuration Presets
76
+ # ==========================================
77
+
78
+ # CONSERVATIVE PRESET (maximum compatibility)
79
+ # jekyll-minifier:
80
+ # compress_css: true
81
+ # compress_javascript: true
82
+ # compress_json: true
83
+ # css_enhanced_mode: false # Use standard compression only
84
+
85
+ # BALANCED PRESET (recommended for most sites)
86
+ # jekyll-minifier:
87
+ # compress_css: true
88
+ # compress_javascript: true
89
+ # compress_json: true
90
+ # css_enhanced_mode: true
91
+ # css_merge_duplicate_selectors: true
92
+ # css_advanced_color_optimization: true
93
+ # css_preserve_ie_hacks: true
94
+
95
+ # AGGRESSIVE PRESET (maximum compression)
96
+ # jekyll-minifier:
97
+ # compress_css: true
98
+ # compress_javascript: true
99
+ # compress_json: true
100
+ # css_enhanced_mode: true
101
+ # css_merge_duplicate_selectors: true
102
+ # css_optimize_shorthand_properties: true
103
+ # css_advanced_color_optimization: true
104
+ # css_preserve_ie_hacks: true
105
+ # css_compress_variables: true
106
+
107
+ # ==========================================
108
+ # Performance Notes
109
+ # ==========================================
110
+
111
+ # Enhanced CSS compression provides significant additional compression:
112
+ # - Standard compression: ~30-40% reduction
113
+ # - Enhanced compression: Additional 20-30% reduction beyond standard
114
+ # - Performance impact: ~13% slower processing (acceptable for production builds)
115
+ # - Memory usage: No significant increase
116
+
117
+ # Compatibility Notes:
118
+ # - Enhanced mode is opt-in (css_enhanced_mode: false by default)
119
+ # - Standard compression behavior unchanged when enhanced mode disabled
120
+ # - All existing configurations continue to work without modification
121
+ # - Enhanced features require cssminify2 v2.1.0+
122
+
123
+ # Migration Guide:
124
+ # 1. Existing users: No changes required (enhanced mode disabled by default)
125
+ # 2. New features: Add css_enhanced_mode: true and desired options
126
+ # 3. Testing: Enable enhanced mode in staging first to validate output
127
+ # 4. Performance: Monitor build times if using CI/CD with time constraints
@@ -0,0 +1,7 @@
1
+ plugins:
2
+ - jekyll-minifier
3
+
4
+ jekyll-minifier:
5
+ remove_comments: true
6
+ compress_css: true
7
+ compress_javascript: true
@@ -0,0 +1,23 @@
1
+ <\!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Test</title>
5
+ <style>
6
+ /* This is a CSS comment */
7
+ body {
8
+ margin: 0;
9
+ padding: 20px;
10
+ }
11
+ </style>
12
+ <script>
13
+ // This is a JS comment
14
+ var test = function() {
15
+ console.log('test');
16
+ };
17
+ </script>
18
+ </head>
19
+ <body>
20
+ <\!-- HTML comment -->
21
+ {{ content }}
22
+ </body>
23
+ </html>
@@ -0,0 +1,10 @@
1
+ /* CSS comment that should be removed */
2
+ .test {
3
+ color: red;
4
+ background-color: #ffffff;
5
+ }
6
+
7
+ /* Another comment */
8
+ .footer {
9
+ margin-top: 20px;
10
+ }
@@ -0,0 +1,9 @@
1
+ // JavaScript comment
2
+ function testFunction() {
3
+ // Another comment
4
+ console.log('This is a test function');
5
+ var unused = 'this variable is not used elsewhere';
6
+ }
7
+
8
+ /* Block comment */
9
+ testFunction();
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+ <h1>Test Page</h1>
5
+ <p>This is a test page to verify Jekyll Minifier is working.</p>
@@ -4,15 +4,14 @@ require File.expand_path('../lib/jekyll-minifier/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.specification_version = 2 if gem.respond_to? :specification_version=
6
6
  gem.required_rubygems_version = Gem::Requirement.new('>= 0') if gem.respond_to? :required_rubygems_version=
7
- gem.rubygems_version = '2.3.1'
8
- gem.required_ruby_version = '>= 2.3.0'
7
+ gem.required_ruby_version = '>= 3.0.0'
9
8
 
10
9
  gem.authors = ["DigitalSparky"]
11
10
  gem.email = ["matthew@spurrier.com.au"]
12
- gem.description = %q{Jekyll Minifier using htmlcompressor for html, uglifier for js and css}
11
+ gem.description = %q{Jekyll Minifier using htmlcompressor for html, terser for js, and cssminify2 for css}
13
12
  gem.summary = %q{Jekyll Minifier for html, css, and javascript}
14
13
  gem.homepage = "http://github.com/digitalsparky/jekyll-minifier"
15
- gem.license = "GPL-3.0"
14
+ gem.license = "GPL-3.0-or-later"
16
15
 
17
16
  gem.files = `git ls-files`.split($\)
18
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -26,14 +25,15 @@ Gem::Specification.new do |gem|
26
25
  gem.version = Jekyll::Minifier::VERSION
27
26
  end
28
27
 
29
- gem.add_dependency "jekyll", ">= 3.5"
30
- gem.add_dependency "uglifier", "~> 4.1"
28
+ gem.add_dependency "jekyll", "~> 4.0"
29
+ gem.add_dependency "terser", "~> 1.2.3"
31
30
  gem.add_dependency "htmlcompressor", "~> 0.4"
32
- gem.add_dependency "cssminify2", "~> 2.0"
31
+ gem.add_dependency "cssminify2", "~> 2.1.0"
33
32
  gem.add_dependency "json-minify", "~> 0.0.3"
34
33
 
35
- gem.add_development_dependency "rake", "~> 12.3"
36
- gem.add_development_dependency "rspec", "~> 3.8"
34
+ gem.add_development_dependency "rake", "~> 13.3"
35
+ gem.add_development_dependency "rspec", "~> 3.13"
37
36
  gem.add_development_dependency "jekyll-paginate", "~> 1.1"
38
37
  gem.add_development_dependency "redcarpet", "~> 3.4"
38
+ gem.add_development_dependency "rss", "~> 0.3"
39
39
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Minifier
3
- VERSION = "0.1.8"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end