jekyll-minifier 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -0
- data/jekyll-minifier.gemspec +1 -1
- data/lib/jekyll-minifier.rb +23 -4
- data/lib/jekyll-minifier/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 05c4b7e33729ca1d8212edf77880beea2ba46396d7484696715206be29444d7d
|
4
|
+
data.tar.gz: f7ecd9dbb911ba8fb5c93b3199c10c1c10e8c51d567a31a1d0a3bd055cf38d67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/jekyll-minifier.gemspec
CHANGED
@@ -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.
|
8
|
+
gem.required_ruby_version = '>= 2.3.0'
|
9
9
|
|
10
10
|
gem.authors = ["DigitalSparky"]
|
11
11
|
gem.email = ["matthew@spurrier.com.au"]
|
data/lib/jekyll-minifier.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
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
|
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))
|
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.
|
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:
|
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.
|
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
|
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
|