octopress-minify-html 1.2.4 → 1.3.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
  SHA1:
3
- metadata.gz: 37f6dee141459023fd18c66d76b04fee3662f7be
4
- data.tar.gz: 4a82e978dfaf3beada51da06894b940b8e5d792c
3
+ metadata.gz: 456847651114a0a363910733b1695f760955b906
4
+ data.tar.gz: c65ca6648aa6538030ad3ddfc96f66b84635ca1d
5
5
  SHA512:
6
- metadata.gz: 5ddb37c757afc52dc99a5333fbaa2ad2f2d28a5cf9fde019e24691189b316e28886156ef9ddbee17d0c9aedd99b04b85560652a712c4cb59d7c92a1210cf82e0
7
- data.tar.gz: bb4ab60002aac4bf8fc4bcb9110fc374b0ef85738a8bb4dfd5a11f63a9b2c70c6c730c1301d7764dd98813c106fc3afd424156feb5ba281afbc346498eced1dc
6
+ metadata.gz: 47042eb9e4d44dcbcb9a2e535e070eb923ea89d06948031a904aa5cbfd6d371711b721b7d6b74fb8f3b3044d030468f1f86610c0ff9fea44469631266f39fffb
7
+ data.tar.gz: 50135e2d7b260bb29abc13bd0d11527ebcb279f4e28c47d759e18ad3602aeae87e6f14f6a23180aa0e916879d5ead5386623ad3f483efddd5e6c8a01bc9cef73
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.3.0 (2015-07-07)
4
+ - New: Support for Jekyll 3.
5
+
3
6
  ### 1.2.4 (2015-03-23)
4
7
 
5
8
  - Added `html_press` configuration for setting compression options.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Octopress Minify Html
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/octopress-minify-html.png)](http://badge.fury.io/rb/octopress-minify-html)
4
- [![Build Status](https://travis-ci.org/octopress/minify-html.png)](https://travis-ci.org/octopress/minify-html)
3
+ [![Gem Version](https://badge.fury.io/rb/octopress-minify-html.svg)](http://badge.fury.io/rb/octopress-minify-html)
4
+ [![Build Status](https://travis-ci.org/octopress/minify-html.svg)](https://travis-ci.org/octopress/minify-html)
5
5
 
6
6
 
7
7
  Minify Jekyll's HTML output with [HtmlPress](https://github.com/stereobooster/html_press)
@@ -1,29 +1,34 @@
1
1
  require 'html_press'
2
- require 'octopress-hooks'
2
+
3
3
  require 'octopress-minify-html/version'
4
4
 
5
5
  module Octopress
6
6
  module MinifyHTML
7
- class MinifyPage < Hooks::All
8
- def post_render(item)
9
- options = MinifyHTML.symbolize(item.site.config['html_press'] || {})
10
- item.output = HtmlPress.press(item.output, options) if minify?(item)
7
+
8
+ extend self
9
+
10
+ def minify(item)
11
+ options = symbolize(item.site.config['html_press'] || {})
12
+ if minify?(item)
13
+ HtmlPress.press(item.output, options)
14
+ else
15
+ item.output
11
16
  end
17
+ end
12
18
 
13
- def minify?(item)
14
- config = item.site.config
15
- if item.destination(config['destination']).end_with?('html')
16
- minify = config['minify_html']
17
- production = config['env'].nil? || config['env'] =~ /production/i
19
+ def minify?(item)
20
+ config = item.site.config
21
+ if item.destination(config['destination']).end_with?('html')
22
+ minify = config['minify_html']
23
+ production = config['env'].nil? || config['env'] =~ /production/i
18
24
 
19
- # Minify if configuration explicitly requires minification
20
- # or if Jekyll env is production
21
- minify || (minify.nil? && production)
22
- end
25
+ # Minify if configuration explicitly requires minification
26
+ # or if Jekyll env is production
27
+ minify || (minify.nil? && production)
23
28
  end
24
29
  end
25
30
 
26
- def self.symbolize(obj)
31
+ def symbolize(obj)
27
32
  return obj.reduce({}) do |memo, (k, v)|
28
33
  memo.tap { |m| m[k.to_sym] = symbolize(v) }
29
34
  end if obj.is_a? Hash
@@ -34,6 +39,19 @@ module Octopress
34
39
 
35
40
  obj
36
41
  end
42
+
43
+ if defined?(Jekyll::Hooks)
44
+ Jekyll::Hooks.register [:post, :page, :document], :post_render do |item|
45
+ item.output = MinifyHTML.minify(item)
46
+ end
47
+ else
48
+ require 'octopress-hooks'
49
+ class MinifyPage < Octopress::Hooks::All
50
+ def post_render(item)
51
+ item.output = MinifyHTML.minify(item)
52
+ end
53
+ end
54
+ end
37
55
  end
38
56
  end
39
57
 
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module MinifyHTML
3
- VERSION = "1.2.4"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-minify-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.3.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: 2015-03-23 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,14 +56,14 @@ dependencies:
56
56
  name: jekyll
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  requirements: []
142
142
  rubyforge_project:
143
- rubygems_version: 2.2.2
143
+ rubygems_version: 2.4.7
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Minify Jekyll's HTML output using html_press