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.
- checksums.yaml +4 -4
- data/.dockerignore +8 -0
- data/.github/FUNDING.yml +3 -0
- data/CLAUDE.md +96 -0
- data/COVERAGE_ANALYSIS.md +228 -0
- data/Dockerfile +30 -0
- data/FINAL_TEST_REPORT.md +164 -0
- data/README.md +17 -12
- data/SECURITY.md +155 -0
- data/SECURITY_FIX_SUMMARY.md +141 -0
- data/VALIDATION_FEATURES.md +254 -0
- data/cody-mcp.db +0 -0
- data/docker-compose.yml +42 -0
- data/example_config.yml +127 -0
- data/issue48-basic/_config.yml +7 -0
- data/issue48-basic/_layouts/default.html +23 -0
- data/issue48-basic/assets/css/style.css +10 -0
- data/issue48-basic/assets/js/script.js +9 -0
- data/issue48-basic/index.html +5 -0
- data/jekyll-minifier.gemspec +9 -9
- data/lib/jekyll-minifier/version.rb +1 -1
- data/lib/jekyll-minifier.rb +1169 -126
- data/spec/caching_performance_spec.rb +238 -0
- data/spec/compressor_cache_spec.rb +326 -0
- data/spec/coverage_enhancement_spec.rb +391 -0
- data/spec/enhanced_css_spec.rb +277 -0
- data/spec/environment_validation_spec.rb +84 -0
- data/spec/fixtures/_config.yml +2 -2
- data/spec/fixtures/assets/data.json +25 -0
- data/spec/fixtures/assets/js/script.js +21 -0
- data/spec/input_validation_spec.rb +514 -0
- data/spec/jekyll-minifier_enhanced_spec.rb +211 -0
- data/spec/jekyll-minifier_spec.rb +61 -0
- data/spec/performance_spec.rb +232 -0
- data/spec/security_redos_spec.rb +306 -0
- data/spec/security_validation_spec.rb +253 -0
- metadata +73 -19
data/example_config.yml
ADDED
@@ -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,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>
|
data/jekyll-minifier.gemspec
CHANGED
@@ -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.
|
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,
|
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", "
|
30
|
-
gem.add_dependency "
|
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", "~>
|
36
|
-
gem.add_development_dependency "rspec", "~> 3.
|
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
|