jekyll-minifier 0.1.5 → 0.1.6

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
- SHA1:
3
- metadata.gz: 0fe021a8c36c58e1b7702d3392151c354cbe6b8e
4
- data.tar.gz: 95cbc0c1e8c9296756539df4db1b6271baa9ce6a
2
+ SHA256:
3
+ metadata.gz: 05c4b7e33729ca1d8212edf77880beea2ba46396d7484696715206be29444d7d
4
+ data.tar.gz: f7ecd9dbb911ba8fb5c93b3199c10c1c10e8c51d567a31a1d0a3bd055cf38d67
5
5
  SHA512:
6
- metadata.gz: 781ecf1c65835259d8ed1ddad44571752531dd32010247890d8d1bfd4021edd84889dbd382374fcf28e2b00e97362928be71a50b7d9ac9d5534f454204530703
7
- data.tar.gz: 616e58e9b3132f6070816261be4b9038bc4c7f6c219935a21524c2e77b0a8197b3af6d2e42d47142a0a0d38f8a3c393e37bde3f4a20666529a5d831f549f67ab
6
+ metadata.gz: 21b4e5d1e805a02f9aa1825714d23d25d18a01f7cf520ac09a6465732cf145c849924627624700470825d771f059cb4173a618f1ba565e9238efb82397d8f43d
7
+ data.tar.gz: 24dd387c6ca9308360c05a0cd184407fb4db7d5dae737d31a480fc27b5f5472938a2840773ab0ccea955872a31630728ea51339fb3c277cf56a71fdade493c73
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # jekyll-minifier [![Build Status](https://travis-ci.org/digitalsparky/jekyll-minifier.svg?branch=master)](https://travis-ci.org/digitalsparky/jekyll-minifier) [![Gem Version](https://badge.fury.io/rb/jekyll-minifier.svg)](http://badge.fury.io/rb/jekyll-minifier)
2
2
 
3
+ Requires Ruby 2.3+
4
+
3
5
  Minifies HTML, XML, CSS, and Javascript both inline and as separate files utilising yui-compressor and htmlcompressor.
4
6
 
5
7
  This was created due to the previous minifier (jekyll-press) not being CSS3 compatible, which made me frown.
@@ -5,7 +5,7 @@ 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
7
  gem.rubygems_version = '2.3.1'
8
- gem.required_ruby_version = '>= 2.0.0'
8
+ gem.required_ruby_version = '>= 2.3.0'
9
9
 
10
10
  gem.authors = ["DigitalSparky"]
11
11
  gem.email = ["matthew@spurrier.com.au"]
@@ -11,6 +11,25 @@ module Jekyll
11
11
  end
12
12
  end
13
13
 
14
+ def output_compressed(path, context)
15
+ case File.extname(path)
16
+ when '.js'
17
+ if path.end_with?('.min.js')
18
+ output_file(path, context)
19
+ else
20
+ output_js(path, context)
21
+ end
22
+ when '.css'
23
+ if path.end_with?('.min.css')
24
+ output_file(path, context)
25
+ else
26
+ output_css(path, context)
27
+ end
28
+ else
29
+ output_html(path, context)
30
+ end
31
+ end
32
+
14
33
  def output_html(path, content)
15
34
  args = { remove_comments: true, compress_css: true, compress_javascript: true, preserve_patterns: [] }
16
35
  args[:css_compressor] = CSSminify2.new
@@ -78,7 +97,7 @@ module Jekyll
78
97
  if exclude?(dest, dest_path)
79
98
  output_file(dest_path, output)
80
99
  else
81
- output_html(dest_path, output)
100
+ output_compressed(dest_path, output)
82
101
  end
83
102
  trigger_hooks(:post_write)
84
103
  end
@@ -92,7 +111,7 @@ module Jekyll
92
111
  if exclude?(dest, dest_path)
93
112
  output_file(dest_path, output)
94
113
  else
95
- output_html(dest_path, output)
114
+ output_compressed(dest_path, output)
96
115
  end
97
116
  Jekyll::Hooks.trigger hook_owner, :post_write, self
98
117
  end
@@ -117,13 +136,13 @@ module Jekyll
117
136
  else
118
137
  case File.extname(dest_path)
119
138
  when '.js'
120
- if dest_path =~ /.min.js$/
139
+ if dest_path.end_with?('.min.js')
121
140
  copy_file(path, dest_path)
122
141
  else
123
142
  output_js(dest_path, File.read(path))
124
143
  end
125
144
  when '.css'
126
- if dest_path =~ /.min.css$/
145
+ if dest_path.end_with?('.min.css')
127
146
  copy_file(path, dest_path)
128
147
  else
129
148
  output_css(dest_path, File.read(path))
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Minifier
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-minifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - DigitalSparky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-03 00:00:00.000000000 Z
11
+ date: 2018-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -166,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
166
  requirements:
167
167
  - - ">="
168
168
  - !ruby/object:Gem::Version
169
- version: 2.0.0
169
+ version: 2.3.0
170
170
  required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  requirements:
172
172
  - - ">="
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  requirements: []
176
176
  rubyforge_project:
177
- rubygems_version: 2.6.13
177
+ rubygems_version: 2.7.6
178
178
  signing_key:
179
179
  specification_version: 2
180
180
  summary: Jekyll Minifier for html, css, and javascript