jekyll-minify-html 1.0.1 → 1.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 +8 -8
- data/CHANGELOG.md +4 -0
- data/README.md +10 -1
- data/lib/jekyll-minify-html.rb +3 -1
- data/lib/jekyll-minify-html/version.rb +1 -1
- data/test/test.rb +29 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWNjZTE4MDdkNDc5NWEyNTdjYzJhNjZjZmQ0MzQxNmExZWNhZDkzZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDY2NTE1M2Y4ZjVjZDAyMTM4YTU0ZmFjZGY2OTgyZjVmODRiNDE4YQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWMxNDFkYmJiMDU4NjY0NGM3OTQxM2FjY2JjYWI0OWY3YTI4M2NiOGIzMjA5
|
10
|
+
ODkxNjU1OWY5ZDQ3OTdjYmU2ZGRkYzdmZDE3M2ZjMmExZGU0ODg1MmIyMjQ4
|
11
|
+
MzUzOGVjYzU0YzdjNzU2MjBiNTM4MGVhNGFkMTlmMjMzMzg2MzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzA0NGRhOTFiNTAzM2E2YzdhYjBkNDk1MjRlMGYxYjBiY2ExNGNhZGJmNDU5
|
14
|
+
ZWRkMjdmZDZjNzEzMjdjYWJmNjc2ZTM5NzgzYzU1MDI2NTIxMDAwMzE0NjFm
|
15
|
+
ZDc2ZTE0ZjBlN2VlOTY0Mzk3OTgzYTNlYzJmNjMyYjcyZmU0OWY=
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -32,12 +32,21 @@ Or you can just create a ruby file in your Jekyll plugins directory with the lin
|
|
32
32
|
|
33
33
|
## Usage
|
34
34
|
|
35
|
-
|
35
|
+
After installing, Jekyll's HTML output will be minified by default. If you configure `env` in your Jekyll configuration, HTML will be minified only when
|
36
|
+
`env` is set to production.
|
36
37
|
|
37
38
|
```yml
|
38
39
|
env: production
|
39
40
|
```
|
40
41
|
|
42
|
+
You can override the default behavior by setting the `minify_html` config.
|
43
|
+
For example, this will disable minification, regardless of your `env` setting.
|
44
|
+
|
45
|
+
```yml
|
46
|
+
minfy_html: false
|
47
|
+
```
|
48
|
+
|
49
|
+
|
41
50
|
## Contributing
|
42
51
|
|
43
52
|
1. Fork it
|
data/lib/jekyll-minify-html.rb
CHANGED
@@ -10,7 +10,9 @@ module Jekyll
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def output_html(path, content)
|
13
|
-
|
13
|
+
minify = @site.config['minify_html']
|
14
|
+
production = @site.config['env'].nil? || @site.config['env'] =~ /production/i
|
15
|
+
if minify || (minify.nil? && production)
|
14
16
|
content = HtmlPress.press(content)
|
15
17
|
end
|
16
18
|
output_file(path, content)
|
data/test/test.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'colorator'
|
2
2
|
|
3
|
-
has_failed
|
4
|
-
config
|
5
|
-
|
3
|
+
has_failed = false
|
4
|
+
config = File.read("_config.yml")
|
5
|
+
disabled = "#{config}minify_html: false"
|
6
|
+
minify = "#{config}env: production"
|
7
|
+
override_off = "#{config}env: production\nminify_html: false"
|
8
|
+
override_on = "#{config}env: development\nminify_html: true"
|
6
9
|
|
7
10
|
def test(type, version)
|
8
11
|
build(version)
|
@@ -31,12 +34,32 @@ def diff_file(file, version)
|
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
37
|
+
## Test default
|
38
|
+
puts "Testing with no configuration"
|
39
|
+
|
40
|
+
test('compressed', "1.0")
|
41
|
+
test('compressed', "0.12")
|
42
|
+
|
43
|
+
puts "Testing with no minify_html: false"
|
44
|
+
File.open("_config.yml", "w") { |f| f.write(disabled) }
|
45
|
+
|
34
46
|
test('uncompressed', "1.0")
|
35
47
|
test('uncompressed', "0.12")
|
36
48
|
|
37
|
-
|
38
|
-
|
39
|
-
|
49
|
+
puts "Testing with env: production"
|
50
|
+
File.open("_config.yml", "w") { |f| f.write(minify) }
|
51
|
+
|
52
|
+
test('compressed', "1.0")
|
53
|
+
test('compressed', "0.12")
|
54
|
+
|
55
|
+
puts "Testing with env: production and minify_html: false"
|
56
|
+
File.open("_config.yml", "w") { |f| f.write(override_off) }
|
57
|
+
|
58
|
+
test('uncompressed', "1.0")
|
59
|
+
test('uncompressed', "0.12")
|
60
|
+
|
61
|
+
puts "Testing with env: production and minify_html: false"
|
62
|
+
File.open("_config.yml", "w") { |f| f.write(override_on) }
|
40
63
|
|
41
64
|
test('compressed', "1.0")
|
42
65
|
test('compressed', "0.12")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-minify-html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|