octopress-minify-html 1.2.0 → 1.2.1

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
2
  SHA1:
3
- metadata.gz: db1b2fb3b6a748d56a510371e1538c6031ac3f92
4
- data.tar.gz: fe0900ad01eca2fb4323c90dbb4f90facff0969d
3
+ metadata.gz: 66f77e6b6bb79662f053933158b6d2fed390df9b
4
+ data.tar.gz: af0050be86b438969992080bebe54fd8b1ddce08
5
5
  SHA512:
6
- metadata.gz: e1a63b011a501ea73324823cc0ad8e6e02e103192beb8336de31ce7c6a17142ac4e7152ffa74478c49fda0e52b3f870c70453597b0e1995974dbec9fa5dbe9d1
7
- data.tar.gz: 419dfe5938aa1c84ccf4b062ed30cbf416e5d43b6a14ecc74d0e697481e9cd0869db9f818ce89f66a0622964db88231a77b8460d3cac07159ecda1f3c968b694
6
+ metadata.gz: 030746768af211227b1e5e810621ff6b0da078f7d1510364a728584a83222c318fa94a8764190f5df3ffe12144e72b200fa6c3fdc0d34d1abeff26067dc4ecfe
7
+ data.tar.gz: dd2b2fbc4e4dafde8824955f955e240b8663a70c84ddc5cf0a85bbb2914ff956892a5eb3df9412585508330f4fcb1225d4463a2e24f68e6cab39815b3a55e88b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.2.1 (2015-01-05)
4
+
5
+ - Rewritten on top of Octopress Hooks.
6
+
3
7
  ### 1.2.0 (2015-01-05)
4
8
 
5
9
  - Added support for Jekyll collections.
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module MinifyHTML
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
@@ -1,63 +1,18 @@
1
1
  require 'html_press'
2
+ require 'octopress-hooks'
2
3
  require 'octopress-minify-html/version'
3
4
 
4
5
  module Octopress
5
6
  module MinifyHTML
6
- def self.output_file(dest, content)
7
- FileUtils.mkdir_p(File.dirname(dest))
8
- File.open(dest, 'w') do |f|
9
- f.write(content)
7
+ class MinifyPage < Hooks::All
8
+ def post_render(item)
9
+ item.output = HtmlPress.press(item.output) if minify?(item.site.config)
10
10
  end
11
- end
12
-
13
- def self.output_html(config, path, content)
14
- minify = config['minify_html']
15
- production = config['env'].nil? || config['env'] =~ /production/i
16
- if minify || (minify.nil? && production)
17
- content = HtmlPress.press(content)
18
- end
19
- output_file(path, content)
20
- end
21
- end
22
- end
23
-
24
- module Jekyll
25
- class Post
26
- def write(dest)
27
- dest_path = destination(dest)
28
- Octopress::MinifyHTML.output_html(@site.config, dest_path, output)
29
- end
30
- end
31
-
32
- class Page
33
- def write(dest)
34
- dest_path = destination(dest)
35
- if File.extname(dest_path).downcase == '.html'
36
- Octopress::MinifyHTML.output_html(@site.config, dest_path, output)
37
- else
38
- Octopress::MinifyHTML.output_file(@site.config, dest_path, output)
39
- end
40
- end
41
- end
42
-
43
- class ConvertiblePage
44
- def write(dest)
45
- dest_path = destination(dest)
46
- if File.extname(dest_path).downcase == '.html'
47
- Octopress::MinifyHTML.output_html(@site.config, dest_path, output)
48
- else
49
- Octopress::MinifyHTML.output_file(@site.config, dest_path, output)
50
- end
51
- end
52
- end
53
11
 
54
- class Document
55
- def write(dest)
56
- dest_path = destination(dest)
57
- if File.extname(dest_path).downcase == '.html'
58
- Octopress::MinifyHTML.output_html(@site.config, dest_path, output)
59
- else
60
- Octopress::MinifyHTML.output_file(@site.config, dest_path, output)
12
+ def minify?(config)
13
+ minify = config['minify_html']
14
+ production = config['env'].nil? || config['env'] =~ /production/i
15
+ minify || (minify.nil? && production)
61
16
  end
62
17
  end
63
18
  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.0
4
+ version: 1.2.1
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-01-05 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.8'
83
+ - !ruby/object:Gem::Dependency
84
+ name: octopress-hooks
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: Minify Jekyll's HTML output using html_press
84
98
  email:
85
99
  - brandon@imathis.com