jekyll-minify-html 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTM5ODJlYzRiNWU0YmMyMzg2MDUzY2QzOTE3YTkwMTI1MDcwZDI1Zg==
4
+ YWNjZTE4MDdkNDc5NWEyNTdjYzJhNjZjZmQ0MzQxNmExZWNhZDkzZA==
5
5
  data.tar.gz: !binary |-
6
- MTMxMzIyOWJiMzVkOGY1MjQ1YWYzNDg3MDU1MDBmZWYxYTk5YjYzZg==
6
+ MDY2NTE1M2Y4ZjVjZDAyMTM4YTU0ZmFjZGY2OTgyZjVmODRiNDE4YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OTJlNzU1MjJiNDliZTFjZDc1YjA4NzIzZTYwOWY1MTA0YjVhOGM2ZTVmNjc3
10
- YzdjMzRmNzUwM2JhYjgyYmYwMmM0Y2JiM2QzZDU3NDM5YjkwNDgxMDYyMzM5
11
- Y2EzMmU4NDIyZmQ3ZTk5YWRkMDE5OTc3NzhiMWIzNzliYzgxYmQ=
9
+ OWMxNDFkYmJiMDU4NjY0NGM3OTQxM2FjY2JjYWI0OWY3YTI4M2NiOGIzMjA5
10
+ ODkxNjU1OWY5ZDQ3OTdjYmU2ZGRkYzdmZDE3M2ZjMmExZGU0ODg1MmIyMjQ4
11
+ MzUzOGVjYzU0YzdjNzU2MjBiNTM4MGVhNGFkMTlmMjMzMzg2MzI=
12
12
  data.tar.gz: !binary |-
13
- Y2Q1ODA5ZGMyMzk4OGQzNWRiNTM4MjY2Yzg5M2YxZDVmNDQzZjU1N2Y3YzAy
14
- YTYyZWJmZGZlNWU2YzkzMjJkNTQ5NGM0NjhiZTkyMjhlZjIzNzNlN2M4ZTRk
15
- YTFmZDQ4YzM4MWRkMjg5MTMzZTM5M2MyM2NmYzU2OGI4M2ExZGQ=
13
+ NzA0NGRhOTFiNTAzM2E2YzdhYjBkNDk1MjRlMGYxYjBiY2ExNGNhZGJmNDU5
14
+ ZWRkMjdmZDZjNzEzMjdjYWJmNjc2ZTM5NzgzYzU1MDI2NTIxMDAwMzE0NjFm
15
+ ZDc2ZTE0ZjBlN2VlOTY0Mzk3OTgzYTNlYzJmNjMyYjcyZmU0OWY=
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0 (2013-11-02)
4
+
5
+ - [CHANGE] Now minifies HTML by default. Disable by setting config `env` to something other than `production` or by setting config `minify_html: false`.
6
+
3
7
  ## 1.0.1 (2013-10-25)
4
8
 
5
9
  - Now compatible with Jekyll 0.12+
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
- Set Jekyll's environment to production in your Jekyll configuration file.
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
@@ -10,7 +10,9 @@ module Jekyll
10
10
  end
11
11
 
12
12
  def output_html(path, content)
13
- if @site.config['env'] && @site.config['env'].downcase === 'production'
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)
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module MinifyHTMLVersion
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -1,8 +1,11 @@
1
1
  require 'colorator'
2
2
 
3
- has_failed = false
4
- config = File.read("_config.yml")
5
- config_prod = "#{config}env: production"
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
- File.open("_config.yml", "w") do |f|
38
- f.write(config_prod)
39
- end
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.1
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-10-25 00:00:00.000000000 Z
11
+ date: 2013-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler