jekyll-zopfli 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77a932d1c765327ad80c8acb0b7ffe107bd5b90b5937f48693ed8579a8fd816f
4
- data.tar.gz: d1b62939ee22db47dbaec6c23ab6561b4cb138223c87f8bb8d11d288ffcac116
3
+ metadata.gz: 5a3d94f9c2b739da1bd99584f6168c3efa2eec8f89e8be2e62f0ba76ebc0622c
4
+ data.tar.gz: 1d44e3cca0978864069f10c6c629b3a5967a95f7da4f841bbd3423cc624da87a
5
5
  SHA512:
6
- metadata.gz: 0d6b369cb4341a67c837aa99b8cbe0a3ee28881ffe2afde2a6d70651293bb9b366a37d2d0e3a376a0eb4af0bb9470ff7ebde1b4d1ff46f3cdf913d2d7b961473
7
- data.tar.gz: 419182038aa67dcd245e035687ea3a016280f3aca5b3c0c590ba957229759df795bb75a606ef9cd72afb63f355839b89aed6a40d2962d034f4ec21b210577937
6
+ metadata.gz: c198291793271662d43d26ba5fca15014c9ee33fdbf9676eb5711fd08a757daf6d8ff281fdb436a577059bcdf92ddbbc1a58880e7ba54bdfbb5870385d5c9940
7
+ data.tar.gz: db7c122bbb10cb6ecd8d2bad9eef1ae2b2e682422b97ca3324ec157a41bd5e47b7827befffd24da1e33764a1d4a4034ec97211ce9efcd98f1d426952ec02ee10
@@ -1,9 +1,13 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
+ - 2.6
4
5
  - 2.5
5
6
  - 2.4
6
7
  - 2.3
7
- - 2.2
8
- before_install: gem install bundler -v 1.16.1
8
+ - ruby-head
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
12
+ before_install: gem install bundler
9
13
  script: bundle exec rspec
@@ -1,9 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## Ongoing [☰](https://github.com/philnash/jekyll-gzip/compare/v1.1.0...master)
3
+ ## Ongoing [☰](https://github.com/philnash/jekyll-gzip/compare/v2.1.0...master)
4
4
 
5
5
  ...
6
6
 
7
+ ## 2.1.0 (2019-03-30) [☰](https://github.com/philnash/jekyll-zopfli/compare/v2.0.0...v2.1.0)
8
+
9
+ ### Added
10
+
11
+ * Adds setting to replace original files with gzipped for serving from AWS S3
12
+
7
13
  ## 2.0.0 (2018-11-24) [☰](https://github.com/philnash/jekyll-zopfli/compare/v1.1.0...v2.0.0)
8
14
 
9
15
  ### Added
data/README.md CHANGED
@@ -65,6 +65,8 @@ In your destination directory (`_site` by default) you will find gzipped version
65
65
 
66
66
  ### Configuration
67
67
 
68
+ #### Extensions
69
+
68
70
  By default, `Jekyll::Zopfli` will compress all files with the following extensions:
69
71
 
70
72
  - '.html'
@@ -88,6 +90,15 @@ zopfli:
88
90
  - '.js
89
91
  ```
90
92
 
93
+ #### Replacing the original file
94
+
95
+ If you host your Jekyll site on AWS S3 you can take advantage of `Jekyll::Zopfli` for compressing the whole site. The only difference is that you need to replace the uncompressed file with the gzipped file (that is, without a `.gz` extension). To enable this in `Jekyll::Zopfli` turn the `replace_files` setting to `true`.
96
+
97
+ ```yml
98
+ zopfli:
99
+ replace_files: true
100
+ ```
101
+
91
102
  ### Serving pre-compiled gzip files
92
103
 
93
104
  You will likely need to adjust your web server config to serve these precomputed gzip files. See below for common server configurations:
@@ -20,11 +20,11 @@ Gem::Specification.new do |spec|
20
20
  spec.bindir = "exe"
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
-
23
+
24
24
  spec.add_dependency "jekyll", "~> 3.0"
25
25
  spec.add_dependency "zopfli", "~> 0.0.7"
26
26
 
27
- spec.add_development_dependency "bundler", "~> 1.16"
27
+ spec.add_development_dependency "bundler", ">= 1.16", "< 3.0"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.0"
30
30
  spec.add_development_dependency "simplecov", "~> 0.15.1"
@@ -25,7 +25,7 @@ module Jekyll
25
25
  # @return void
26
26
  def self.compress_site(site)
27
27
  site.each_site_file do |file|
28
- compress_file(file.destination(site.dest), zippable_extensions(site))
28
+ compress_file(file.destination(site.dest), extensions: zippable_extensions(site))
29
29
  end
30
30
  end
31
31
 
@@ -45,7 +45,7 @@ module Jekyll
45
45
  def self.compress_directory(dir, site)
46
46
  extensions = zippable_extensions(site).join(',')
47
47
  files = Dir.glob(dir + "**/*{#{extensions}}")
48
- files.each { |file| compress_file(file, zippable_extensions(site)) }
48
+ files.each { |file| compress_file(file, extensions: zippable_extensions(site)) }
49
49
  end
50
50
 
51
51
  ##
@@ -60,11 +60,13 @@ module Jekyll
60
60
  # @param file_name [String] The file name of the file we want to compress
61
61
  # @param extensions [Array<String>] The extensions of files that will be
62
62
  # compressed.
63
+ # @param replace_file [Boolean] Whether the origina file should be
64
+ # replaced or written alongside the original with a `.gz` extension
63
65
  #
64
66
  # @return void
65
- def self.compress_file(file_name, extensions)
67
+ def self.compress_file(file_name, extensions: [], replace_file: false)
66
68
  return unless extensions.include?(File.extname(file_name))
67
- zipped = "#{file_name}.gz"
69
+ zipped = replace_file ? file_name : "#{file_name}.gz"
68
70
  contents = ::Zopfli.deflate(File.read(file_name), format: :gzip)
69
71
  File.open(zipped, "w+") do |file|
70
72
  file << contents
@@ -14,7 +14,8 @@ module Jekyll
14
14
  '.xml',
15
15
  '.svg',
16
16
  '.eot'
17
- ].freeze
17
+ ].freeze,
18
+ 'replace_files' => false
18
19
  }.freeze
19
20
  end
20
21
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Zopfli
5
- VERSION = "2.0.0"
5
+ VERSION = "2.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-zopfli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.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: 2018-11-24 00:00:00.000000000 Z
11
+ date: 2019-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -42,16 +42,22 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.16'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: '1.16'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -138,8 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
144
  - !ruby/object:Gem::Version
139
145
  version: '0'
140
146
  requirements: []
141
- rubyforge_project:
142
- rubygems_version: 2.7.7
147
+ rubygems_version: 3.0.3
143
148
  signing_key:
144
149
  specification_version: 4
145
150
  summary: Generate gzipped assets and files for your Jekyll site at build time using