jekyll-gzip 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e6c5f628c1b543e3efe2a02b3690eaeb0d03590dbead795bd83ed7a51978b59
4
- data.tar.gz: cc72f33252c97c3948c883f39fc12f5dd016ff49403dad6e63137fbfbb25fcb5
3
+ metadata.gz: 9cd633c28c8cb3598fe2026d582716f6c8dcad49e11886032e1a1860cd540fbd
4
+ data.tar.gz: 5ca08691643c435a45293869d4964428335de8c3455f8872f96436b93680aabd
5
5
  SHA512:
6
- metadata.gz: ab402cf215ff857fb4724da88fcfe48327830e208f34033204c17230ded4793f5f77d45bb14e1e10841e3b73373b13dd5cc7d04a1d135c941448f6085085b254
7
- data.tar.gz: a2a882cb1d76ac8128069404106fe69b95aceb4698c21c240de29899ff5f8abd475e6efcbf5738f21f8a1d1d0b5af3fbb66902db0251f1636acb9a5e2361de60
6
+ metadata.gz: c8afea9d74a9c4c419d5b8348d0b383f6dc51ea7dd236f743047376ecd90e57d11f9021cb3c6606f1a5ad0460ca6287454e1d50502f7c6b707f28ec6daba315f
7
+ data.tar.gz: f4ee3d3febd15c9eea55b34a82ef2d1791baa6a10bf6395867d6543bf63266856d67feff6450c5b3cfa54c43878f3503d5fef0c1bc0b74c102d21d3dc7dee7c5
data/.travis.yml CHANGED
@@ -1,9 +1,14 @@
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
+
13
+ before_install: gem install bundler
9
14
  script: bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -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-gzip/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-gzip/compare/v1.1.0...v2.0.0)
8
14
 
9
15
  ### Added
data/README.md CHANGED
@@ -63,6 +63,8 @@ In your destination directory (`_site` by default) you will find gzipped version
63
63
 
64
64
  ### Configuration
65
65
 
66
+ #### Extensions
67
+
66
68
  By default, `Jekyll::Gzip` will compress all files with the following extensions:
67
69
 
68
70
  - '.html'
@@ -86,6 +88,15 @@ gzip:
86
88
  - '.js
87
89
  ```
88
90
 
91
+ #### Replacing the original file
92
+
93
+ If you host your Jekyll site on AWS S3 you can take advantage of `Jekyll::Gzip` 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::Gzip` turn the `replace_files` setting to `true`.
94
+
95
+ ```yml
96
+ gzip:
97
+ replace_files: true
98
+ ```
99
+
89
100
  ### Serving pre-compiled gzip files
90
101
 
91
102
  You will likely need to adjust your web server config to serve these precomputed gzip files. See below for common server configurations:
data/jekyll-gzip.gemspec CHANGED
@@ -20,10 +20,10 @@ 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
 
26
- spec.add_development_dependency "bundler", "~> 1.16"
26
+ spec.add_development_dependency "bundler", ">= 1.16", "< 3.0"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  spec.add_development_dependency "simplecov", "~> 0.15.1"
@@ -25,7 +25,11 @@ 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(
29
+ file.destination(site.dest),
30
+ extensions: zippable_extensions(site),
31
+ replace_file: replace_files(site)
32
+ )
29
33
  end
30
34
  end
31
35
 
@@ -44,8 +48,9 @@ module Jekyll
44
48
  # @return void
45
49
  def self.compress_directory(dir, site)
46
50
  extensions = zippable_extensions(site).join(',')
51
+ replace_file = replace_files(site)
47
52
  files = Dir.glob(dir + "**/*{#{extensions}}")
48
- files.each { |file| compress_file(file, extensions) }
53
+ files.each { |file| compress_file(file, extensions: extensions, replace_file: replace_file) }
49
54
  end
50
55
 
51
56
  ##
@@ -62,9 +67,9 @@ module Jekyll
62
67
  # compressed.
63
68
  #
64
69
  # @return void
65
- def self.compress_file(file_name, extensions)
70
+ def self.compress_file(file_name, extensions: [], replace_file: false)
66
71
  return unless extensions.include?(File.extname(file_name))
67
- zipped = "#{file_name}.gz"
72
+ zipped = replace_file ? file_name : "#{file_name}.gz"
68
73
  Zlib::GzipWriter.open(zipped, Zlib::BEST_COMPRESSION) do |gz|
69
74
  gz.mtime = File.mtime(file_name)
70
75
  gz.orig_name = file_name
@@ -75,7 +80,12 @@ module Jekyll
75
80
  private
76
81
 
77
82
  def self.zippable_extensions(site)
78
- site.config['gzip'] && site.config['gzip']['extensions'] || Jekyll::Gzip::DEFAULT_CONFIG['extensions']
83
+ site.config.dig('gzip', 'extensions') || Jekyll::Gzip::DEFAULT_CONFIG['extensions']
84
+ end
85
+
86
+ def self.replace_files(site)
87
+ replace_files = site.config.dig('gzip', 'replace_files')
88
+ replace_files.nil? ? Jekyll::Gzip::DEFAULT_CONFIG['replace_files'] : replace_files
79
89
  end
80
90
  end
81
91
  end
@@ -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 Gzip
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-gzip
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
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.16'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '3.0'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '1.16'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rake
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -123,8 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
129
  - !ruby/object:Gem::Version
124
130
  version: '0'
125
131
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.7.7
132
+ rubygems_version: 3.0.3
128
133
  signing_key:
129
134
  specification_version: 4
130
135
  summary: Generate gzipped assets and files for your Jekyll site at build time