octopress-minify-html 1.2.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: db1b2fb3b6a748d56a510371e1538c6031ac3f92
4
+ data.tar.gz: fe0900ad01eca2fb4323c90dbb4f90facff0969d
5
+ SHA512:
6
+ metadata.gz: e1a63b011a501ea73324823cc0ad8e6e02e103192beb8336de31ce7c6a17142ac4e7152ffa74478c49fda0e52b3f870c70453597b0e1995974dbec9fa5dbe9d1
7
+ data.tar.gz: 419dfe5938aa1c84ccf4b062ed30cbf416e5d43b6a14ecc74d0e697481e9cd0869db9f818ce89f66a0622964db88231a77b8460d3cac07159ecda1f3c968b694
data/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ ### 1.2.0 (2015-01-05)
4
+
5
+ - Added support for Jekyll collections.
6
+ - Renamed to octopress-minify-html.
7
+
8
+ ### 1.1.0 (2013-11-02)
9
+
10
+ - [CHANGE] Now minifies HTML by default. Disable by setting config `env` to something other than `production` or by setting config `minify_html: false`.
11
+
12
+ ### 1.0.1 (2013-10-25)
13
+
14
+ - Now compatible with Jekyll 0.12+
15
+ - Added tests for Jekyll 0.12 and Jekyll 1.0
16
+
17
+ ### 1.0.0 (2013-10-24)
18
+
19
+ Initial Release
20
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Brandon Mathis
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Octopress Minify Html
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)
5
+
6
+
7
+ Minify Jekyll's HTML output with [html_press](https://github.com/stereobooster/html_press)
8
+
9
+ ## Installation
10
+
11
+ ### Using Bundler
12
+
13
+ Add this gem to your site's Gemfile in the `:jekyll_plugins` group:
14
+
15
+ group :jekyll_plugins do
16
+ gem 'octopress-minify-html'
17
+ end
18
+
19
+ Then install the gem with Bundler
20
+
21
+ $ bundle
22
+
23
+ ### Manual Installation
24
+
25
+ $ gem install octopress-minify-html
26
+
27
+ Then add the gem to your Jekyll configuration.
28
+
29
+ gems:
30
+ - octopress-minify-html
31
+
32
+ ## Usage
33
+
34
+ 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
35
+ `env` is set to production.
36
+
37
+ ```yml
38
+ env: production
39
+ ```
40
+
41
+ You can override the default behavior by setting the `minify_html` config.
42
+ For example, this will disable minification, regardless of your `env` setting.
43
+
44
+ ```yml
45
+ minify_html: false
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it
51
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
53
+ 4. Push to the branch (`git push origin my-new-feature`)
54
+ 5. Create new Pull Request
@@ -0,0 +1,75 @@
1
+ require 'html_press'
2
+ require 'octopress-minify-html/version'
3
+
4
+ module Octopress
5
+ 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)
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
+
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)
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ if defined? Octopress::Docs
67
+ Octopress::Docs.add({
68
+ name: "Octopress Minify HTML",
69
+ gem: "octopress-minify-html",
70
+ description: "Automatically minifies HTML output for your Jekyll site.",
71
+ path: File.expand_path(File.join(File.dirname(__FILE__), "../")),
72
+ source_url: "https://github.com/octopress/minify-html",
73
+ version: Octopress::MinifyHTML::VERSION
74
+ })
75
+ end
@@ -0,0 +1,5 @@
1
+ module Octopress
2
+ module MinifyHTML
3
+ VERSION = "1.2.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octopress-minify-html
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Brandon Mathis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: clash
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jekyll
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: html_press
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.8'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.8'
83
+ description: Minify Jekyll's HTML output using html_press
84
+ email:
85
+ - brandon@imathis.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - CHANGELOG.md
91
+ - LICENSE.txt
92
+ - README.md
93
+ - lib/octopress-minify-html.rb
94
+ - lib/octopress-minify-html/version.rb
95
+ homepage: https://github.com/octopress/minify-html
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.2.2
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Minify Jekyll's HTML output using html_press
119
+ test_files: []