jekyll-brotli 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +11 -0
- data/lib/jekyll/brotli/compressor.rb +12 -4
- data/lib/jekyll/brotli/config.rb +1 -0
- data/lib/jekyll/brotli/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c64a996a9fe2af91db335a3a66c6d5aeef748c0c58b0f5c9a5b2f995b28ab00
|
4
|
+
data.tar.gz: 69564e1e0da087c05028b8f3668718ccd102e7da04e692f7d8a9b13f46cfb78b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c7f4f353f34de9557b80780acfcfb8230a0ea45568cc5e7b06bff14b8049d77eede4da9e814d9ae749224134eac3ef8c61bb709db7a559ef6a53667199edcf1
|
7
|
+
data.tar.gz: 10fac03e16ae9e6db997cb231fe2ce8f3bc1a01eaa03e542d8ce655c6fbcbc376098f3e5057e9f54e36f8288a4256a143864b71e57b0c302bd5eb3b3e597b5d2
|
data/.github/workflows/tests.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,12 @@
|
|
4
4
|
|
5
5
|
...
|
6
6
|
|
7
|
+
## 2.4.0 (2023-08-29) [☰](https://github.com/philnash/jekyll-brotli/compare/v2.3.0...v2.4.0)
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- Added config to set the Brotli compression level (thanks [@fauno](https://github.com/fauno))
|
12
|
+
|
7
13
|
## 2.3.0 (2021-02-13) [☰](https://github.com/philnash/jekyll-brotli/compare/v2.2.1...v2.3.0)
|
8
14
|
|
9
15
|
### Fixed
|
data/README.md
CHANGED
@@ -66,6 +66,17 @@ brotli:
|
|
66
66
|
- '.js
|
67
67
|
```
|
68
68
|
|
69
|
+
#### Compression quality
|
70
|
+
|
71
|
+
By default, `Jekyll::Brotli` uses the maximum compression quality
|
72
|
+
supported by Brotli, which is 11. You can supply your own compression
|
73
|
+
quality by setting a number between 0 and 11 on `_config.yml`.
|
74
|
+
|
75
|
+
```yml
|
76
|
+
brotli:
|
77
|
+
quality: 9
|
78
|
+
```
|
79
|
+
|
69
80
|
### Serving pre-compiled gzip files
|
70
81
|
|
71
82
|
You will likely need to adjust your web server config to serve these precomputed gzip files. See below for common server configurations:
|
@@ -24,12 +24,15 @@ module Jekyll
|
|
24
24
|
#
|
25
25
|
# @return void
|
26
26
|
def self.compress_site(site)
|
27
|
+
quality = compression_quality(site)
|
28
|
+
|
27
29
|
site.each_site_file do |file|
|
28
30
|
next unless regenerate? file.destination(site.dest), site
|
29
31
|
|
30
32
|
compress_file(
|
31
33
|
file.destination(site.dest),
|
32
|
-
compressable_extensions(site)
|
34
|
+
compressable_extensions(site),
|
35
|
+
quality
|
33
36
|
)
|
34
37
|
end
|
35
38
|
end
|
@@ -50,10 +53,11 @@ module Jekyll
|
|
50
53
|
def self.compress_directory(dir, site)
|
51
54
|
extensions = compressable_extensions(site).join(',')
|
52
55
|
files = Dir.glob(File.join(dir, "**", "*{#{extensions}}"))
|
56
|
+
quality = compression_quality(site)
|
53
57
|
files.each do |file|
|
54
58
|
next unless regenerate? file, site
|
55
59
|
|
56
|
-
compress_file(file, compressable_extensions(site))
|
60
|
+
compress_file(file, compressable_extensions(site), quality)
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
@@ -71,10 +75,10 @@ module Jekyll
|
|
71
75
|
# compressed.
|
72
76
|
#
|
73
77
|
# @return void
|
74
|
-
def self.compress_file(file_name, extensions)
|
78
|
+
def self.compress_file(file_name, extensions, quality = 11)
|
75
79
|
return unless extensions.include?(File.extname(file_name))
|
76
80
|
compressed = compressed(file_name)
|
77
|
-
contents = ::Brotli.deflate(File.read(file_name), quality:
|
81
|
+
contents = ::Brotli.deflate(File.read(file_name), quality: quality)
|
78
82
|
|
79
83
|
Jekyll.logger.debug "Brotli: #{compressed}"
|
80
84
|
|
@@ -94,6 +98,10 @@ module Jekyll
|
|
94
98
|
site.config.dig("brotli", "extensions") || Jekyll::Brotli::DEFAULT_CONFIG.fetch("extensions")
|
95
99
|
end
|
96
100
|
|
101
|
+
def self.compression_quality(site)
|
102
|
+
site.config.dig("brotli", "quality") || Jekyll::Brotli::DEFAULT_CONFIG.fetch("quality")
|
103
|
+
end
|
104
|
+
|
97
105
|
# Compresses the file if the site is built incrementally and the
|
98
106
|
# source was modified or the compressed file doesn't exist
|
99
107
|
def self.regenerate?(file, site)
|
data/lib/jekyll/brotli/config.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-brotli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Nash
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
154
|
+
rubygems_version: 3.3.3
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: Generate brotli compressed assets and files for your Jekyll site at build
|