jekyll-minifier 0.1.9 → 0.2.0
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/Dockerfile +30 -0
- data/README.md +18 -12
- data/cody-mcp.db +0 -0
- data/docker-compose.yml +42 -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 +10 -9
- data/lib/jekyll-minifier/version.rb +1 -1
- data/lib/jekyll-minifier.rb +50 -14
- data/spec/fixtures/_config.yml +2 -2
- data/spec/fixtures/_site/404.html +1 -0
- data/spec/fixtures/_site/assets/css/style.css +1 -0
- data/spec/fixtures/_site/assets/js/script.js +1 -0
- data/spec/fixtures/_site/atom.xml +1 -0
- data/spec/fixtures/_site/index.html +1 -0
- data/spec/fixtures/_site/random/index.html +1 -0
- data/spec/fixtures/_site/random/random.html +1 -0
- data/spec/fixtures/_site/reviews/index.html +1 -0
- data/spec/fixtures/_site/reviews/test-review-1.html +1 -0
- data/spec/fixtures/_site/reviews/test-review-2.html +1 -0
- data/spec/fixtures/assets/js/script.js +21 -0
- data/spec/jekyll-minifier_spec.rb +61 -0
- metadata +82 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9c8ff59e853f86badd113bb3c7f9d09cc4824fc46c1fe7e59f3c6afed5442d1
|
4
|
+
data.tar.gz: c81f521515954bf675da6bbc93d9360d776f1db43afab2574a587db5ccc90423
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73a07b8875dcb66ba64e2ecd79241392c937cfd1913986b67e051ff6b6edfed36865e7cb17c548f2d6e995c2bc59510bb996b4291058f1845d3bef8d0720698b
|
7
|
+
data.tar.gz: 7e558379ed8e79dd4c70750a552d0c811f9f9e36d3158f912483719f72c5f27cbcaba1f6066d78ed28672925efb290c086af3807e1be7493bd89d6afaae49051
|
data/.dockerignore
ADDED
data/.github/FUNDING.yml
ADDED
data/CLAUDE.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# CLAUDE.md
|
2
|
+
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
4
|
+
|
5
|
+
## Project Overview
|
6
|
+
|
7
|
+
Jekyll Minifier is a Ruby gem that provides minification for Jekyll sites. It compresses HTML, XML, CSS, JSON and JavaScript files both inline and as separate files using terser, cssminify2, json-minify and htmlcompressor. The gem only runs when `JEKYLL_ENV="production"` is set.
|
8
|
+
|
9
|
+
## Release Status (v0.2.0)
|
10
|
+
|
11
|
+
**READY FOR RELEASE** - All integrations completed and validated:
|
12
|
+
- ✅ Modernized to Ruby 3.3.9, Jekyll 4.x compatibility
|
13
|
+
- ✅ Migrated from Uglifier to Terser (with backward compatibility)
|
14
|
+
- ✅ Fixed critical bugs #49 (nil pointer) and #51 (preserve_patterns)
|
15
|
+
- ✅ Integrated CSS performance improvements (PR #61)
|
16
|
+
- ✅ Comprehensive test suite: 26/26 tests passing
|
17
|
+
- ✅ Docker development environment fully functional
|
18
|
+
- ✅ Updated dependencies and improved ES6+ support
|
19
|
+
|
20
|
+
## Development Commands
|
21
|
+
|
22
|
+
### Local Development
|
23
|
+
```bash
|
24
|
+
# Install dependencies
|
25
|
+
bundle install
|
26
|
+
|
27
|
+
# Build the gem
|
28
|
+
gem build jekyll-minifier.gemspec
|
29
|
+
|
30
|
+
# Run tests
|
31
|
+
bundle exec rspec
|
32
|
+
|
33
|
+
# Run all rake tasks (check available tasks first)
|
34
|
+
bundle exec rake --tasks
|
35
|
+
```
|
36
|
+
|
37
|
+
### Docker Development
|
38
|
+
```bash
|
39
|
+
# Build Docker image
|
40
|
+
docker compose build
|
41
|
+
|
42
|
+
# Run tests in production environment (default)
|
43
|
+
docker compose up jekyll-minifier
|
44
|
+
|
45
|
+
# Run tests in development environment
|
46
|
+
docker compose up test-dev
|
47
|
+
|
48
|
+
# Build the gem
|
49
|
+
docker compose up build
|
50
|
+
|
51
|
+
# Get interactive shell for development
|
52
|
+
docker compose run dev
|
53
|
+
|
54
|
+
# Run specific commands
|
55
|
+
docker compose run jekyll-minifier bundle exec rspec --format documentation
|
56
|
+
```
|
57
|
+
|
58
|
+
## Architecture
|
59
|
+
|
60
|
+
### Core Structure
|
61
|
+
- **Main module**: `Jekyll::Compressor` mixin that provides compression functionality
|
62
|
+
- **Integration points**: Monkey patches Jekyll's `Document`, `Page`, and `StaticFile` classes to add compression during the write process
|
63
|
+
- **File type detection**: Uses file extensions (`.js`, `.css`, `.json`, `.html`, `.xml`) to determine compression strategy
|
64
|
+
|
65
|
+
### Compression Strategy
|
66
|
+
The gem handles different file types through dedicated methods:
|
67
|
+
- `output_html()` - HTML/XML compression using HtmlCompressor
|
68
|
+
- `output_js()` - JavaScript compression using Terser
|
69
|
+
- `output_css()` - CSS compression using CSSminify2
|
70
|
+
- `output_json()` - JSON minification using json-minify
|
71
|
+
|
72
|
+
### Key Design Patterns
|
73
|
+
- **Mixin pattern**: `Jekyll::Compressor` module mixed into Jekyll core classes
|
74
|
+
- **Strategy pattern**: Different compression methods based on file extension
|
75
|
+
- **Configuration-driven**: Extensive YAML configuration options in `_config.yml`
|
76
|
+
- **Environment-aware**: Only activates in production environment
|
77
|
+
|
78
|
+
### Configuration System
|
79
|
+
All settings are under `jekyll-minifier` key in `_config.yml` with options like:
|
80
|
+
- File exclusions via `exclude` (supports glob patterns)
|
81
|
+
- HTML compression toggles (remove comments, spaces, etc.)
|
82
|
+
- JavaScript/CSS/JSON compression toggles
|
83
|
+
- Advanced options like preserve patterns and terser arguments
|
84
|
+
|
85
|
+
### Testing Framework
|
86
|
+
- Uses RSpec for testing
|
87
|
+
- Test fixtures in `spec/fixtures/` simulate a complete Jekyll site
|
88
|
+
- Tests verify file generation and basic content validation
|
89
|
+
- Mock Jekyll environment with production flag set
|
90
|
+
|
91
|
+
## File Organization
|
92
|
+
- `lib/jekyll-minifier.rb` - Main compression logic and Jekyll integration
|
93
|
+
- `lib/jekyll-minifier/version.rb` - Version constant
|
94
|
+
- `spec/jekyll-minifier_spec.rb` - Test suite
|
95
|
+
- `spec/spec_helper.rb` - Test configuration
|
96
|
+
- `spec/fixtures/` - Test Jekyll site with layouts, posts, and assets
|
data/Dockerfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Use official Ruby image with a specific version for consistency
|
2
|
+
FROM ruby:3.3.9-slim
|
3
|
+
|
4
|
+
# Install system dependencies
|
5
|
+
RUN apt-get update && apt-get install -y \
|
6
|
+
build-essential \
|
7
|
+
git \
|
8
|
+
nodejs \
|
9
|
+
npm \
|
10
|
+
default-jre-headless \
|
11
|
+
&& rm -rf /var/lib/apt/lists/*
|
12
|
+
|
13
|
+
# Set working directory
|
14
|
+
WORKDIR /app
|
15
|
+
|
16
|
+
# Copy gemspec and Gemfile first (for better Docker layer caching)
|
17
|
+
COPY jekyll-minifier.gemspec Gemfile ./
|
18
|
+
COPY lib/jekyll-minifier/version.rb lib/jekyll-minifier/
|
19
|
+
|
20
|
+
# Install Ruby dependencies
|
21
|
+
RUN bundle install
|
22
|
+
|
23
|
+
# Copy the rest of the application
|
24
|
+
COPY . .
|
25
|
+
|
26
|
+
# Set environment variables
|
27
|
+
ENV JEKYLL_ENV=production
|
28
|
+
|
29
|
+
# Default command
|
30
|
+
CMD ["bundle", "exec", "rspec"]
|
data/README.md
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
# jekyll-minifier [](https://travis-ci.org/digitalsparky/jekyll-minifier) [](http://badge.fury.io/rb/jekyll-minifier)
|
2
2
|
|
3
|
-
Requires Ruby
|
3
|
+
Requires Ruby 3.0+
|
4
4
|
|
5
|
-
|
5
|
+
## Key Features
|
6
|
+
|
7
|
+
- **Modern ES6+ Support**: Now uses Terser instead of Uglifier for better modern JavaScript support
|
8
|
+
- **Production-Only**: Only runs when `JEKYLL_ENV="production"` for optimal development experience
|
9
|
+
- **Comprehensive Minification**: Handles HTML, XML, CSS, JSON, and JavaScript files
|
10
|
+
- **Backward Compatible**: Supports legacy `uglifier_args` configuration for easy migration
|
11
|
+
|
12
|
+
Minifies HTML, XML, CSS, JSON and JavaScript both inline and as separate files utilising terser, cssminify2, json-minify and htmlcompressor.
|
6
13
|
|
7
14
|
This was created due to the previous minifier (jekyll-press) not being CSS3 compatible, which made me frown.
|
8
15
|
|
@@ -37,6 +44,7 @@ and toggle features and settings using:
|
|
37
44
|
remove_quotes: false # Default: false
|
38
45
|
compress_css: true # Default: true
|
39
46
|
compress_javascript: true # Default: true
|
47
|
+
compress_json: true # Default: true
|
40
48
|
simple_doctype: false # Default: false
|
41
49
|
remove_script_attributes: false # Default: false
|
42
50
|
remove_style_attributes: false # Default: false
|
@@ -50,19 +58,17 @@ and toggle features and settings using:
|
|
50
58
|
simple_boolean_attributes: false # Default: false
|
51
59
|
compress_js_templates: false # Default: false
|
52
60
|
preserve_patterns: # Default: (empty)
|
53
|
-
|
61
|
+
terser_args: # Default: (empty)
|
54
62
|
</code></pre>
|
55
63
|
|
56
|
-
|
64
|
+
terser_args can be found in the [terser-ruby](https://github.com/ahorek/terser-ruby) documentation.
|
57
65
|
|
58
|
-
Note:
|
59
|
-
See https://github.com/lautis/uglifier for more information.
|
66
|
+
Note: For backward compatibility, `uglifier_args` is also supported and will be treated as `terser_args`.
|
60
67
|
|
61
|
-
To enable es6 syntax use:
|
62
68
|
|
63
|
-
|
64
|
-
jekyll-minifier:
|
65
|
-
uglifier_args:
|
66
|
-
harmony: true
|
69
|
+
# Like my stuff?
|
67
70
|
|
68
|
-
|
71
|
+
Would you like to buy me a coffee or send me a tip?
|
72
|
+
While it's not expected, I would really appreciate it.
|
73
|
+
|
74
|
+
[](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>
|
data/cody-mcp.db
ADDED
Binary file
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
services:
|
2
|
+
jekyll-minifier:
|
3
|
+
build: .
|
4
|
+
volumes:
|
5
|
+
- .:/app
|
6
|
+
- bundle_cache:/usr/local/bundle
|
7
|
+
environment:
|
8
|
+
- JEKYLL_ENV=production
|
9
|
+
command: bash -c "bundle install && bundle exec rspec"
|
10
|
+
|
11
|
+
# Service for development with shell access
|
12
|
+
dev:
|
13
|
+
build: .
|
14
|
+
volumes:
|
15
|
+
- .:/app
|
16
|
+
- bundle_cache:/usr/local/bundle
|
17
|
+
environment:
|
18
|
+
- JEKYLL_ENV=production
|
19
|
+
command: bash
|
20
|
+
stdin_open: true
|
21
|
+
tty: true
|
22
|
+
|
23
|
+
# Service for building the gem
|
24
|
+
build:
|
25
|
+
build: .
|
26
|
+
volumes:
|
27
|
+
- .:/app
|
28
|
+
- bundle_cache:/usr/local/bundle
|
29
|
+
command: bash -c "bundle install && gem build jekyll-minifier.gemspec"
|
30
|
+
|
31
|
+
# Service for testing in development environment
|
32
|
+
test-dev:
|
33
|
+
build: .
|
34
|
+
volumes:
|
35
|
+
- .:/app
|
36
|
+
- bundle_cache:/usr/local/bundle
|
37
|
+
environment:
|
38
|
+
- JEKYLL_ENV=development
|
39
|
+
command: bash -c "bundle install && bundle exec rspec"
|
40
|
+
|
41
|
+
volumes:
|
42
|
+
bundle_cache:
|
@@ -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,13 +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.0.1"
|
32
|
+
gem.add_dependency "json-minify", "~> 0.0.3"
|
33
33
|
|
34
|
-
gem.add_development_dependency "rake", "~>
|
35
|
-
gem.add_development_dependency "rspec", "~> 3.
|
34
|
+
gem.add_development_dependency "rake", "~> 13.3"
|
35
|
+
gem.add_development_dependency "rspec", "~> 3.13"
|
36
36
|
gem.add_development_dependency "jekyll-paginate", "~> 1.1"
|
37
37
|
gem.add_development_dependency "redcarpet", "~> 3.4"
|
38
|
+
gem.add_development_dependency "rss", "~> 0.3"
|
38
39
|
end
|
data/lib/jekyll-minifier.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'terser'
|
2
2
|
require 'htmlcompressor'
|
3
3
|
require 'cssminify2'
|
4
|
+
require 'json/minify'
|
4
5
|
|
5
6
|
module Jekyll
|
6
7
|
module Compressor
|
@@ -19,6 +20,8 @@ module Jekyll
|
|
19
20
|
else
|
20
21
|
output_js(path, context)
|
21
22
|
end
|
23
|
+
when '.json'
|
24
|
+
output_json(path, context)
|
22
25
|
when '.css'
|
23
26
|
if path.end_with?('.min.css')
|
24
27
|
output_file(path, context)
|
@@ -37,8 +40,13 @@ module Jekyll
|
|
37
40
|
|
38
41
|
opts = @site.config['jekyll-minifier']
|
39
42
|
if ( !opts.nil? )
|
40
|
-
# Javascript Arguments
|
41
|
-
|
43
|
+
# Javascript Arguments (support both terser_args and uglifier_args for backward compatibility)
|
44
|
+
terser_options = opts['terser_args'] || opts['uglifier_args']
|
45
|
+
if terser_options && terser_options.respond_to?(:map)
|
46
|
+
# Filter out Uglifier-specific options that don't have Terser equivalents
|
47
|
+
filtered_options = terser_options.reject { |k, v| k.to_s == 'harmony' }
|
48
|
+
js_args[:terser_args] = Hash[filtered_options.map{|(k,v)| [k.to_sym,v]}] unless filtered_options.empty?
|
49
|
+
end
|
42
50
|
|
43
51
|
# HTML Arguments
|
44
52
|
html_args[:remove_spaces_inside_tags] = opts['remove_spaces_inside_tags'] if opts.has_key?('remove_spaces_inside_tags')
|
@@ -61,15 +69,15 @@ module Jekyll
|
|
61
69
|
html_args[:simple_boolean_attributes] = opts['simple_boolean_attributes'] if opts.has_key?('simple_boolean_attributes')
|
62
70
|
html_args[:compress_js_templates] = opts['compress_js_templates'] if opts.has_key?('compress_js_templates')
|
63
71
|
html_args[:preserve_patterns] += [/<\?php.*?\?>/im] if opts['preserve_php'] == true
|
64
|
-
html_args[:preserve_patterns] += opts[
|
72
|
+
html_args[:preserve_patterns] += opts['preserve_patterns'].map { |pattern| Regexp.new(pattern)} if opts.has_key?('preserve_patterns') && opts['preserve_patterns'] && opts['preserve_patterns'].respond_to?(:map)
|
65
73
|
end
|
66
74
|
|
67
75
|
html_args[:css_compressor] = CSSminify2.new()
|
68
76
|
|
69
|
-
if ( !js_args.nil? )
|
70
|
-
html_args[:javascript_compressor] =
|
77
|
+
if ( !js_args[:terser_args].nil? )
|
78
|
+
html_args[:javascript_compressor] = ::Terser.new(js_args[:terser_args])
|
71
79
|
else
|
72
|
-
html_args[:javascript_compressor] =
|
80
|
+
html_args[:javascript_compressor] = ::Terser.new()
|
73
81
|
end
|
74
82
|
|
75
83
|
compressor = HtmlCompressor::Compressor.new(html_args)
|
@@ -81,18 +89,25 @@ module Jekyll
|
|
81
89
|
|
82
90
|
def output_js(path, content)
|
83
91
|
if ( ENV['JEKYLL_ENV'] == "production" )
|
84
|
-
|
92
|
+
js_args = {}
|
93
|
+
opts = @site.config['jekyll-minifier']
|
85
94
|
compress = true
|
86
95
|
if ( !opts.nil? )
|
87
|
-
compress
|
88
|
-
|
96
|
+
compress = opts['compress_javascript'] if opts.has_key?('compress_javascript')
|
97
|
+
# Support both terser_args and uglifier_args for backward compatibility
|
98
|
+
terser_options = opts['terser_args'] || opts['uglifier_args']
|
99
|
+
if terser_options && terser_options.respond_to?(:map)
|
100
|
+
# Filter out Uglifier-specific options that don't have Terser equivalents
|
101
|
+
filtered_options = terser_options.reject { |k, v| k.to_s == 'harmony' }
|
102
|
+
js_args[:terser_args] = Hash[filtered_options.map{|(k,v)| [k.to_sym,v]}] unless filtered_options.empty?
|
103
|
+
end
|
89
104
|
end
|
90
105
|
|
91
106
|
if ( compress )
|
92
|
-
if ( !js_args.nil? )
|
93
|
-
compressor =
|
107
|
+
if ( !js_args[:terser_args].nil? )
|
108
|
+
compressor = ::Terser.new(js_args[:terser_args])
|
94
109
|
else
|
95
|
-
compressor =
|
110
|
+
compressor = ::Terser.new()
|
96
111
|
end
|
97
112
|
|
98
113
|
output_file(path, compressor.compile(content))
|
@@ -104,6 +119,24 @@ module Jekyll
|
|
104
119
|
end
|
105
120
|
end
|
106
121
|
|
122
|
+
def output_json(path, content)
|
123
|
+
if ( ENV['JEKYLL_ENV'] == "production" )
|
124
|
+
opts = @site.config['jekyll-minifier']
|
125
|
+
compress = true
|
126
|
+
if ( !opts.nil? )
|
127
|
+
compress = opts['compress_json'] if opts.has_key?('compress_json')
|
128
|
+
end
|
129
|
+
|
130
|
+
if ( compress )
|
131
|
+
output_file(path, JSON.minify(content))
|
132
|
+
else
|
133
|
+
output_file(path, content)
|
134
|
+
end
|
135
|
+
else
|
136
|
+
output_file(path, content)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
107
140
|
def output_css(path, content)
|
108
141
|
if ( ENV['JEKYLL_ENV'] == "production" )
|
109
142
|
opts = @site.config['jekyll-minifier']
|
@@ -113,7 +146,8 @@ module Jekyll
|
|
113
146
|
end
|
114
147
|
if ( compress )
|
115
148
|
compressor = CSSminify2.new()
|
116
|
-
|
149
|
+
# Pass nil to disable line breaks completely for performance (PR #61)
|
150
|
+
output_file(path, compressor.compress(content, nil))
|
117
151
|
else
|
118
152
|
output_file(path, content)
|
119
153
|
end
|
@@ -187,6 +221,8 @@ module Jekyll
|
|
187
221
|
else
|
188
222
|
output_js(dest_path, File.read(path))
|
189
223
|
end
|
224
|
+
when '.json'
|
225
|
+
output_json(dest_path, File.read(path))
|
190
226
|
when '.css'
|
191
227
|
if dest_path.end_with?('.min.css')
|
192
228
|
copy_file(path, dest_path)
|
data/spec/fixtures/_config.yml
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html> <html lang="en-us"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title> 404: Page not found · Example.com </title> <link rel="stylesheet" href="//cdn.jsdelivr.net/g/bootstrap@3.3(css/bootstrap-theme.min.css+css/bootstrap.min.css)" crossorigin="anonymous"> <!--[if lt IE 9]><script src="//cdn.jsdelivr.net/g/html5shiv@3.7.3,respond@1.4.2" crossorigin="anonymous"></script><![endif]--> <link rel="stylesheet" href="https://example.com/assets/css/style.css"> <link rel="alternate" type="application/atom+xml" title="Example.com" href="https://example.com/atom.xml"> <script type="text/javascript" src="https://example.com/assets/js/script.js"></script> </head> <body class="layout-reverse sidebar-overlay"> <input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> <div class="sidebar" id="sidebar"> <div class="sidebar-item"> <p></p> </div> <nav class="sidebar-nav"> <a class="sidebar-nav-item" href="https://example.com">Home</a> <a class="sidebar-nav-item" href="https://example.com/random/">Random</a> <a class="sidebar-nav-item" href="https://example.com/reviews/">Reviews</a> <a class="sidebar-nav-item" href="https://www.github.com/example/" rel="nofollow" target="_blank">GitHub</a> </nav> </div> <div class="wrap"> <div class="masthead"> <div class="container"> <h3 class="masthead-title"> <a href="/" title="Home">Example.com</a> <small>Example!</small> </h3> </div> </div> <div class="container content"> <div class="page"> <h1 class="page-title">404: Page not found</h1> <p class="lead">Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. <a href="https://example.com">Head back home</a> to try finding it again.</p> </div> </div> </div> <label for="sidebar-checkbox" class="sidebar-toggle"></label> <footer class="footer"> <div class="container"> <p class="text-muted text-center">© Copyright 2025 Example. All rights reserved.</p> </div> </footer> <script>!function(e){var c=e.querySelector(".sidebar-toggle"),r=e.querySelector("#sidebar"),t=e.querySelector("#sidebar-checkbox");e.addEventListener("click",function(e){var n=e.target;t.checked&&!r.contains(n)&&n!==t&&n!==c&&(t.checked=!1)},!1)}(document);</script> </body> </html>
|
@@ -0,0 +1 @@
|
|
1
|
+
html{position:relative;min-height:100%}body{margin-bottom:60px}.footer{position:absolute;bottom:0;width:100%;height:60px;background-color:#f5f5f5}.footer .container .text-muted{margin:20px 0}#brandServiceList li>a{background-color:#fff!important}a.outlink{text-decoration:none;font-color:#000}.list-nobullet{list-style-type:none}#logo{display:inline-block;height:100px}
|
@@ -0,0 +1 @@
|
|
1
|
+
var sampleFunction=function(){console.log("This is sample.")};sampleFunction();const modernFunction=()=>{return"Hello ES6+"};class TestClass{constructor(n){this.value=n}getValue(){return this.value}}const instance=new TestClass("test");console.log(modernFunction()),console.log(instance.getValue());
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title type="text" xml:lang="en">Example.com</title> <link type="application/atom+xml" href="https://example.com/atom.xml" rel="self"/> <link href="https://example.com/"/> <updated>2025-08-11T22:36:29Z</updated> <id>https://example.com/</id> <author> <name>Example</name> <email>example@example.com</email> </author> <rights type="text">Copyright © 2025 Example. All Rights Reserved.</rights> <entry> <title>Random</title> <link rel="alternate" type="text/html" href="https://example.com/random/random.html"/> <published>2015-01-01T00:00:00Z</published> <updated>2015-01-01T00:00:00+08:00</updated> <id>https://example.com/random/random.html</id> <content type="html"><![CDATA[ <p>Random!</p> ]]></content> </entry> <entry> <title>Test Review 2</title> <link rel="alternate" type="text/html" href="https://example.com/reviews/test-review-2.html"/> <published>2013-04-03T00:00:00Z</published> <updated>2013-04-03T00:00:00+08:00</updated> <id>https://example.com/reviews/test-review-2.html</id> <content type="html"><![CDATA[ <p>Test Review 2</p> ]]></content> </entry> <entry> <title>Test Review 1</title> <link rel="alternate" type="text/html" href="https://example.com/reviews/test-review-1.html"/> <published>2012-04-03T00:00:00Z</published> <updated>2012-04-03T00:00:00+08:00</updated> <id>https://example.com/reviews/test-review-1.html</id> <content type="html"><![CDATA[ <p>Test Review 1</p> ]]></content> </entry> </feed>
|
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html> <html lang="en-us"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title> Example.com · Example! </title> <link rel="stylesheet" href="//cdn.jsdelivr.net/g/bootstrap@3.3(css/bootstrap-theme.min.css+css/bootstrap.min.css)" crossorigin="anonymous"> <!--[if lt IE 9]><script src="//cdn.jsdelivr.net/g/html5shiv@3.7.3,respond@1.4.2" crossorigin="anonymous"></script><![endif]--> <link rel="stylesheet" href="https://example.com/assets/css/style.css"> <link rel="alternate" type="application/atom+xml" title="Example.com" href="https://example.com/atom.xml"> <script type="text/javascript" src="https://example.com/assets/js/script.js"></script> </head> <body class="layout-reverse sidebar-overlay"> <input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> <div class="sidebar" id="sidebar"> <div class="sidebar-item"> <p></p> </div> <nav class="sidebar-nav"> <a class="sidebar-nav-item" href="https://example.com">Home</a> <a class="sidebar-nav-item" href="https://example.com/random/">Random</a> <a class="sidebar-nav-item" href="https://example.com/reviews/">Reviews</a> <a class="sidebar-nav-item" href="https://www.github.com/example/" rel="nofollow" target="_blank">GitHub</a> </nav> </div> <div class="wrap"> <div class="masthead"> <div class="container"> <h3 class="masthead-title"> <a href="/" title="Home">Example.com</a> <small>Example!</small> </h3> </div> </div> <div class="container content"> <div class="posts"> <div class="post"> <h1 class="post-title"> <a href="https://example.com/random/random.html"> Random </a> </h1> <span class="post-date">01 Jan 2015</span> <p> <p>Random!</p> </p> <p> <a href="https://example.com/random/random.html" title="Random"> Read More </a> </p> </div> <div class="post"> <h1 class="post-title"> <a href="https://example.com/reviews/test-review-2.html"> Test Review 2 </a> </h1> <span class="post-date">03 Apr 2013</span> <p> <p>Test Review 2</p> </p> <p> <a href="https://example.com/reviews/test-review-2.html" title="Test Review 2"> Read More </a> </p> </div> <div class="post"> <h1 class="post-title"> <a href="https://example.com/reviews/test-review-1.html"> Test Review 1 </a> </h1> <span class="post-date">03 Apr 2012</span> <p> <p>Test Review 1</p> </p> <p> <a href="https://example.com/reviews/test-review-1.html" title="Test Review 1"> Read More </a> </p> </div> </div> <div class="pagination"> <span class="pagination-item older">Older</span> <span class="pagination-item newer">Newer</span> </div> </div> </div> <label for="sidebar-checkbox" class="sidebar-toggle"></label> <footer class="footer"> <div class="container"> <p class="text-muted text-center">© Copyright 2025 Example. All rights reserved.</p> </div> </footer> <script>!function(e){var c=e.querySelector(".sidebar-toggle"),r=e.querySelector("#sidebar"),t=e.querySelector("#sidebar-checkbox");e.addEventListener("click",function(e){var n=e.target;t.checked&&!r.contains(n)&&n!==t&&n!==c&&(t.checked=!1)},!1)}(document);</script> </body> </html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html> <html lang="en-us"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title> random · Example.com </title> <link rel="stylesheet" href="//cdn.jsdelivr.net/g/bootstrap@3.3(css/bootstrap-theme.min.css+css/bootstrap.min.css)" crossorigin="anonymous"> <!--[if lt IE 9]><script src="//cdn.jsdelivr.net/g/html5shiv@3.7.3,respond@1.4.2" crossorigin="anonymous"></script><![endif]--> <link rel="stylesheet" href="https://example.com/assets/css/style.css"> <link rel="alternate" type="application/atom+xml" title="Example.com" href="https://example.com/atom.xml"> <script type="text/javascript" src="https://example.com/assets/js/script.js"></script> </head> <body class="layout-reverse sidebar-overlay"> <input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> <div class="sidebar" id="sidebar"> <div class="sidebar-item"> <p></p> </div> <nav class="sidebar-nav"> <a class="sidebar-nav-item" href="https://example.com">Home</a> <a class="sidebar-nav-item active" href="https://example.com/random/">Random</a> <a class="sidebar-nav-item" href="https://example.com/reviews/">Reviews</a> <a class="sidebar-nav-item" href="https://www.github.com/example/" rel="nofollow" target="_blank">GitHub</a> </nav> </div> <div class="wrap"> <div class="masthead"> <div class="container"> <h3 class="masthead-title"> <a href="/" title="Home">Example.com</a> <small>Example!</small> </h3> </div> </div> <div class="container content"> <div class="page"> <h1 class="page-title">Random</h1> <div class="page-content wc-container"> <table> <tr> <td><i class="icon-clock"></i><time datetime="2015-01-01">Jan 01, 2015</time></td> <td><a href="https://example.com/random/random.html">Random</a></td> </tr> </table> </div> </div> </div> </div> <label for="sidebar-checkbox" class="sidebar-toggle"></label> <footer class="footer"> <div class="container"> <p class="text-muted text-center">© Copyright 2025 Example. All rights reserved.</p> </div> </footer> <script>!function(e){var c=e.querySelector(".sidebar-toggle"),r=e.querySelector("#sidebar"),t=e.querySelector("#sidebar-checkbox");e.addEventListener("click",function(e){var n=e.target;t.checked&&!r.contains(n)&&n!==t&&n!==c&&(t.checked=!1)},!1)}(document);</script> </body> </html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html> <html lang="en-us"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title> Random · Example.com </title> <link rel="stylesheet" href="//cdn.jsdelivr.net/g/bootstrap@3.3(css/bootstrap-theme.min.css+css/bootstrap.min.css)" crossorigin="anonymous"> <!--[if lt IE 9]><script src="//cdn.jsdelivr.net/g/html5shiv@3.7.3,respond@1.4.2" crossorigin="anonymous"></script><![endif]--> <link rel="stylesheet" href="https://example.com/assets/css/style.css"> <link rel="alternate" type="application/atom+xml" title="Example.com" href="https://example.com/atom.xml"> <script type="text/javascript" src="https://example.com/assets/js/script.js"></script> </head> <body class="layout-reverse sidebar-overlay"> <input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> <div class="sidebar" id="sidebar"> <div class="sidebar-item"> <p></p> </div> <nav class="sidebar-nav"> <a class="sidebar-nav-item" href="https://example.com">Home</a> <a class="sidebar-nav-item" href="https://example.com/random/">Random</a> <a class="sidebar-nav-item" href="https://example.com/reviews/">Reviews</a> <a class="sidebar-nav-item" href="https://www.github.com/example/" rel="nofollow" target="_blank">GitHub</a> </nav> </div> <div class="wrap"> <div class="masthead"> <div class="container"> <h3 class="masthead-title"> <a href="/" title="Home">Example.com</a> <small>Example!</small> </h3> </div> </div> <div class="container content"> <div class="post"> <h1 class="post-title">Random</h1> <span class="post-date">01 Jan 2015</span> <p>Random!</p> </div> <div class="related"> <h2>Related Posts</h2> <ul class="related-posts"> <li> <h3> <a href="https://example.com/reviews/test-review-2.html"> Test Review 2 <small>03 Apr 2013</small> </a> </h3> </li> <li> <h3> <a href="https://example.com/reviews/test-review-1.html"> Test Review 1 <small>03 Apr 2012</small> </a> </h3> </li> </ul> </div> </div> </div> <label for="sidebar-checkbox" class="sidebar-toggle"></label> <footer class="footer"> <div class="container"> <p class="text-muted text-center">© Copyright 2025 Example. All rights reserved.</p> </div> </footer> <script>!function(e){var c=e.querySelector(".sidebar-toggle"),r=e.querySelector("#sidebar"),t=e.querySelector("#sidebar-checkbox");e.addEventListener("click",function(e){var n=e.target;t.checked&&!r.contains(n)&&n!==t&&n!==c&&(t.checked=!1)},!1)}(document);</script> </body> </html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html> <html lang="en-us"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title> reviews · Example.com </title> <link rel="stylesheet" href="//cdn.jsdelivr.net/g/bootstrap@3.3(css/bootstrap-theme.min.css+css/bootstrap.min.css)" crossorigin="anonymous"> <!--[if lt IE 9]><script src="//cdn.jsdelivr.net/g/html5shiv@3.7.3,respond@1.4.2" crossorigin="anonymous"></script><![endif]--> <link rel="stylesheet" href="https://example.com/assets/css/style.css"> <link rel="alternate" type="application/atom+xml" title="Example.com" href="https://example.com/atom.xml"> <script type="text/javascript" src="https://example.com/assets/js/script.js"></script> </head> <body class="layout-reverse sidebar-overlay"> <input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> <div class="sidebar" id="sidebar"> <div class="sidebar-item"> <p></p> </div> <nav class="sidebar-nav"> <a class="sidebar-nav-item" href="https://example.com">Home</a> <a class="sidebar-nav-item" href="https://example.com/random/">Random</a> <a class="sidebar-nav-item active" href="https://example.com/reviews/">Reviews</a> <a class="sidebar-nav-item" href="https://www.github.com/example/" rel="nofollow" target="_blank">GitHub</a> </nav> </div> <div class="wrap"> <div class="masthead"> <div class="container"> <h3 class="masthead-title"> <a href="/" title="Home">Example.com</a> <small>Example!</small> </h3> </div> </div> <div class="container content"> <div class="page"> <h1 class="page-title">Reviews</h1> <div class="page-content wc-container"> <table> <tr> <td><i class="icon-clock"></i><time datetime="2013-04-03">Apr 03, 2013</time></td> <td><a href="https://example.com/reviews/test-review-2.html">Test Review 2</a></td> </tr> <tr> <td><i class="icon-clock"></i><time datetime="2012-04-03">Apr 03, 2012</time></td> <td><a href="https://example.com/reviews/test-review-1.html">Test Review 1</a></td> </tr> </table> </div> </div> </div> </div> <label for="sidebar-checkbox" class="sidebar-toggle"></label> <footer class="footer"> <div class="container"> <p class="text-muted text-center">© Copyright 2025 Example. All rights reserved.</p> </div> </footer> <script>!function(e){var c=e.querySelector(".sidebar-toggle"),r=e.querySelector("#sidebar"),t=e.querySelector("#sidebar-checkbox");e.addEventListener("click",function(e){var n=e.target;t.checked&&!r.contains(n)&&n!==t&&n!==c&&(t.checked=!1)},!1)}(document);</script> </body> </html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html> <html lang="en-us"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title> Test Review 1 · Example.com </title> <link rel="stylesheet" href="//cdn.jsdelivr.net/g/bootstrap@3.3(css/bootstrap-theme.min.css+css/bootstrap.min.css)" crossorigin="anonymous"> <!--[if lt IE 9]><script src="//cdn.jsdelivr.net/g/html5shiv@3.7.3,respond@1.4.2" crossorigin="anonymous"></script><![endif]--> <link rel="stylesheet" href="https://example.com/assets/css/style.css"> <link rel="alternate" type="application/atom+xml" title="Example.com" href="https://example.com/atom.xml"> <script type="text/javascript" src="https://example.com/assets/js/script.js"></script> </head> <body class="layout-reverse sidebar-overlay"> <input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> <div class="sidebar" id="sidebar"> <div class="sidebar-item"> <p></p> </div> <nav class="sidebar-nav"> <a class="sidebar-nav-item" href="https://example.com">Home</a> <a class="sidebar-nav-item" href="https://example.com/random/">Random</a> <a class="sidebar-nav-item" href="https://example.com/reviews/">Reviews</a> <a class="sidebar-nav-item" href="https://www.github.com/example/" rel="nofollow" target="_blank">GitHub</a> </nav> </div> <div class="wrap"> <div class="masthead"> <div class="container"> <h3 class="masthead-title"> <a href="/" title="Home">Example.com</a> <small>Example!</small> </h3> </div> </div> <div class="container content"> <div class="post"> <h1 class="post-title">Test Review 1</h1> <span class="post-date">03 Apr 2012</span> <p>Test Review 1</p> </div> <div class="related"> <h2>Related Posts</h2> <ul class="related-posts"> <li> <h3> <a href="https://example.com/random/random.html"> Random <small>01 Jan 2015</small> </a> </h3> </li> <li> <h3> <a href="https://example.com/reviews/test-review-2.html"> Test Review 2 <small>03 Apr 2013</small> </a> </h3> </li> </ul> </div> </div> </div> <label for="sidebar-checkbox" class="sidebar-toggle"></label> <footer class="footer"> <div class="container"> <p class="text-muted text-center">© Copyright 2025 Example. All rights reserved.</p> </div> </footer> <script>!function(e){var c=e.querySelector(".sidebar-toggle"),r=e.querySelector("#sidebar"),t=e.querySelector("#sidebar-checkbox");e.addEventListener("click",function(e){var n=e.target;t.checked&&!r.contains(n)&&n!==t&&n!==c&&(t.checked=!1)},!1)}(document);</script> </body> </html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html> <html lang="en-us"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title> Test Review 2 · Example.com </title> <link rel="stylesheet" href="//cdn.jsdelivr.net/g/bootstrap@3.3(css/bootstrap-theme.min.css+css/bootstrap.min.css)" crossorigin="anonymous"> <!--[if lt IE 9]><script src="//cdn.jsdelivr.net/g/html5shiv@3.7.3,respond@1.4.2" crossorigin="anonymous"></script><![endif]--> <link rel="stylesheet" href="https://example.com/assets/css/style.css"> <link rel="alternate" type="application/atom+xml" title="Example.com" href="https://example.com/atom.xml"> <script type="text/javascript" src="https://example.com/assets/js/script.js"></script> </head> <body class="layout-reverse sidebar-overlay"> <input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"> <div class="sidebar" id="sidebar"> <div class="sidebar-item"> <p></p> </div> <nav class="sidebar-nav"> <a class="sidebar-nav-item" href="https://example.com">Home</a> <a class="sidebar-nav-item" href="https://example.com/random/">Random</a> <a class="sidebar-nav-item" href="https://example.com/reviews/">Reviews</a> <a class="sidebar-nav-item" href="https://www.github.com/example/" rel="nofollow" target="_blank">GitHub</a> </nav> </div> <div class="wrap"> <div class="masthead"> <div class="container"> <h3 class="masthead-title"> <a href="/" title="Home">Example.com</a> <small>Example!</small> </h3> </div> </div> <div class="container content"> <div class="post"> <h1 class="post-title">Test Review 2</h1> <span class="post-date">03 Apr 2013</span> <p>Test Review 2</p> </div> <div class="related"> <h2>Related Posts</h2> <ul class="related-posts"> <li> <h3> <a href="https://example.com/random/random.html"> Random <small>01 Jan 2015</small> </a> </h3> </li> <li> <h3> <a href="https://example.com/reviews/test-review-1.html"> Test Review 1 <small>03 Apr 2012</small> </a> </h3> </li> </ul> </div> </div> </div> <label for="sidebar-checkbox" class="sidebar-toggle"></label> <footer class="footer"> <div class="container"> <p class="text-muted text-center">© Copyright 2025 Example. All rights reserved.</p> </div> </footer> <script>!function(e){var c=e.querySelector(".sidebar-toggle"),r=e.querySelector("#sidebar"),t=e.querySelector("#sidebar-checkbox");e.addEventListener("click",function(e){var n=e.target;t.checked&&!r.contains(n)&&n!==t&&n!==c&&(t.checked=!1)},!1)}(document);</script> </body> </html>
|
@@ -1,4 +1,25 @@
|
|
1
|
+
// Legacy JavaScript
|
1
2
|
var sampleFunction = function() {
|
2
3
|
console.log('This is sample.');
|
3
4
|
};
|
4
5
|
sampleFunction();
|
6
|
+
|
7
|
+
// Modern ES6+ JavaScript to test harmony mode
|
8
|
+
const modernFunction = () => {
|
9
|
+
const message = `Hello ES6+`;
|
10
|
+
return message;
|
11
|
+
};
|
12
|
+
|
13
|
+
class TestClass {
|
14
|
+
constructor(value) {
|
15
|
+
this.value = value;
|
16
|
+
}
|
17
|
+
|
18
|
+
getValue() {
|
19
|
+
return this.value;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
const instance = new TestClass('test');
|
24
|
+
console.log(modernFunction());
|
25
|
+
console.log(instance.getValue());
|
@@ -63,6 +63,14 @@ describe "JekyllMinifier" do
|
|
63
63
|
it "ensures assets/css/style.css file has length" do
|
64
64
|
expect(file.length).to be > 0
|
65
65
|
end
|
66
|
+
|
67
|
+
it "ensures CSS is minified without line breaks for performance (PR #61 integration)" do
|
68
|
+
# This test validates PR #61: CSS minification without line breaks for better performance
|
69
|
+
# The linebreakpos: 0 parameter should eliminate all line breaks in CSS output
|
70
|
+
expect(file).not_to include("\n"), "CSS should be minified to a single line for performance optimization"
|
71
|
+
expect(file).not_to include("\r"), "CSS should not contain carriage returns"
|
72
|
+
expect(file.split("\n").length).to eq(1), "CSS should be compressed to exactly one line"
|
73
|
+
end
|
66
74
|
end
|
67
75
|
|
68
76
|
context "test_404" do
|
@@ -149,4 +157,57 @@ describe "JekyllMinifier" do
|
|
149
157
|
end
|
150
158
|
end
|
151
159
|
|
160
|
+
context "test_es6_javascript" do
|
161
|
+
it "creates a assets/js/script.js file with ES6+ content" do
|
162
|
+
expect(Pathname.new(dest_dir("assets/js/script.js"))).to exist
|
163
|
+
end
|
164
|
+
|
165
|
+
let(:es6_js) { File.read(dest_dir("assets/js/script.js")) }
|
166
|
+
|
167
|
+
it "ensures script.js file has been minified and has length" do
|
168
|
+
expect(es6_js.length).to be > 0
|
169
|
+
# Verify it's actually minified by checking it doesn't contain original comments and formatting
|
170
|
+
expect(es6_js).not_to include("// Legacy JavaScript")
|
171
|
+
expect(es6_js).not_to include("// Modern ES6+ JavaScript to test harmony mode")
|
172
|
+
expect(es6_js).not_to include("\n ")
|
173
|
+
end
|
174
|
+
|
175
|
+
it "handles ES6+ syntax (const, arrow functions, classes) without errors" do
|
176
|
+
# If the file exists and has content, it means ES6+ was processed successfully
|
177
|
+
# The original script.js now contains const, arrow functions, and classes
|
178
|
+
expect(es6_js.length).to be > 0
|
179
|
+
# Verify legacy function is still there (should be minified)
|
180
|
+
expect(es6_js).to include("sampleFunction")
|
181
|
+
# The fact that the build succeeded means ES6+ syntax was processed without errors
|
182
|
+
end
|
183
|
+
|
184
|
+
it "maintains backward compatibility with legacy JavaScript" do
|
185
|
+
# Verify legacy JS is still processed correctly alongside ES6+ code
|
186
|
+
expect(es6_js.length).to be > 0
|
187
|
+
expect(es6_js).to include("sampleFunction")
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context "test_backward_compatibility" do
|
192
|
+
let(:overrides) {
|
193
|
+
{
|
194
|
+
"jekyll-minifier" => {
|
195
|
+
"uglifier_args" => { "harmony" => true }
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
let(:js_content) { File.read(dest_dir("assets/js/script.js")) }
|
201
|
+
|
202
|
+
it "supports uglifier_args for backward compatibility" do
|
203
|
+
# If the build succeeds with uglifier_args in config, backward compatibility works
|
204
|
+
expect(Pathname.new(dest_dir("assets/js/script.js"))).to exist
|
205
|
+
|
206
|
+
# Verify the JS file was processed and has content
|
207
|
+
expect(js_content.length).to be > 0
|
208
|
+
# Verify it's minified (no comments or excessive whitespace)
|
209
|
+
expect(js_content).not_to include("// Legacy JavaScript")
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
152
213
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-minifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DigitalSparky
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: terser
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.2.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.2.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: htmlcompressor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,42 +58,56 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.0.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json-minify
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.0.3
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 0.0.3
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '13.3'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '13.3'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
103
|
+
version: '3.13'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
110
|
+
version: '3.13'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: jekyll-paginate
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,19 +136,45 @@ dependencies:
|
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '3.4'
|
125
|
-
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rss
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.3'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.3'
|
153
|
+
description: Jekyll Minifier using htmlcompressor for html, terser for js, and cssminify2
|
154
|
+
for css
|
126
155
|
email:
|
127
156
|
- matthew@spurrier.com.au
|
128
157
|
executables: []
|
129
158
|
extensions: []
|
130
159
|
extra_rdoc_files: []
|
131
160
|
files:
|
161
|
+
- ".dockerignore"
|
162
|
+
- ".github/FUNDING.yml"
|
132
163
|
- ".gitignore"
|
133
164
|
- ".travis.yml"
|
165
|
+
- CLAUDE.md
|
166
|
+
- Dockerfile
|
134
167
|
- Gemfile
|
135
168
|
- LICENSE
|
136
169
|
- README.md
|
137
170
|
- Rakefile
|
171
|
+
- cody-mcp.db
|
172
|
+
- docker-compose.yml
|
173
|
+
- issue48-basic/_config.yml
|
174
|
+
- issue48-basic/_layouts/default.html
|
175
|
+
- issue48-basic/assets/css/style.css
|
176
|
+
- issue48-basic/assets/js/script.js
|
177
|
+
- issue48-basic/index.html
|
138
178
|
- jekyll-minifier.gemspec
|
139
179
|
- lib/jekyll-minifier.rb
|
140
180
|
- lib/jekyll-minifier/version.rb
|
@@ -149,6 +189,16 @@ files:
|
|
149
189
|
- spec/fixtures/_posts/2012-04-03-test-review-1.markdown
|
150
190
|
- spec/fixtures/_posts/2013-04-03-test-review-2.markdown
|
151
191
|
- spec/fixtures/_posts/2015-01-01-random.markdown
|
192
|
+
- spec/fixtures/_site/404.html
|
193
|
+
- spec/fixtures/_site/assets/css/style.css
|
194
|
+
- spec/fixtures/_site/assets/js/script.js
|
195
|
+
- spec/fixtures/_site/atom.xml
|
196
|
+
- spec/fixtures/_site/index.html
|
197
|
+
- spec/fixtures/_site/random/index.html
|
198
|
+
- spec/fixtures/_site/random/random.html
|
199
|
+
- spec/fixtures/_site/reviews/index.html
|
200
|
+
- spec/fixtures/_site/reviews/test-review-1.html
|
201
|
+
- spec/fixtures/_site/reviews/test-review-2.html
|
152
202
|
- spec/fixtures/assets/css/style.css
|
153
203
|
- spec/fixtures/assets/js/script.js
|
154
204
|
- spec/fixtures/atom.xml
|
@@ -157,9 +207,9 @@ files:
|
|
157
207
|
- spec/spec_helper.rb
|
158
208
|
homepage: http://github.com/digitalsparky/jekyll-minifier
|
159
209
|
licenses:
|
160
|
-
- GPL-3.0
|
210
|
+
- GPL-3.0-or-later
|
161
211
|
metadata: {}
|
162
|
-
post_install_message:
|
212
|
+
post_install_message:
|
163
213
|
rdoc_options: []
|
164
214
|
require_paths:
|
165
215
|
- lib
|
@@ -167,16 +217,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
217
|
requirements:
|
168
218
|
- - ">="
|
169
219
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
220
|
+
version: 3.0.0
|
171
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
222
|
requirements:
|
173
223
|
- - ">="
|
174
224
|
- !ruby/object:Gem::Version
|
175
225
|
version: '0'
|
176
226
|
requirements: []
|
177
|
-
|
178
|
-
|
179
|
-
signing_key:
|
227
|
+
rubygems_version: 3.5.22
|
228
|
+
signing_key:
|
180
229
|
specification_version: 2
|
181
230
|
summary: Jekyll Minifier for html, css, and javascript
|
182
231
|
test_files:
|
@@ -191,6 +240,16 @@ test_files:
|
|
191
240
|
- spec/fixtures/_posts/2012-04-03-test-review-1.markdown
|
192
241
|
- spec/fixtures/_posts/2013-04-03-test-review-2.markdown
|
193
242
|
- spec/fixtures/_posts/2015-01-01-random.markdown
|
243
|
+
- spec/fixtures/_site/404.html
|
244
|
+
- spec/fixtures/_site/assets/css/style.css
|
245
|
+
- spec/fixtures/_site/assets/js/script.js
|
246
|
+
- spec/fixtures/_site/atom.xml
|
247
|
+
- spec/fixtures/_site/index.html
|
248
|
+
- spec/fixtures/_site/random/index.html
|
249
|
+
- spec/fixtures/_site/random/random.html
|
250
|
+
- spec/fixtures/_site/reviews/index.html
|
251
|
+
- spec/fixtures/_site/reviews/test-review-1.html
|
252
|
+
- spec/fixtures/_site/reviews/test-review-2.html
|
194
253
|
- spec/fixtures/assets/css/style.css
|
195
254
|
- spec/fixtures/assets/js/script.js
|
196
255
|
- spec/fixtures/atom.xml
|