middleman-minify-html 3.0.0.beta.3 → 3.0.0.rc.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.
- data/.gitignore +2 -0
- data/.travis.yml +4 -3
- data/Rakefile +6 -1
- data/features/preview.feature +1 -1
- data/lib/middleman-minify-html/extension.rb +4 -34
- data/lib/middleman-minify-html/version.rb +1 -1
- data/lib/middleman-minify-html.rb +1 -1
- data/middleman-minify-html.gemspec +2 -2
- metadata +9 -9
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
@@ -4,7 +4,12 @@ Bundler::GemHelper.install_tasks
|
|
4
4
|
require 'cucumber/rake/task'
|
5
5
|
|
6
6
|
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
7
|
-
|
7
|
+
ENV["TEST"] = "true"
|
8
|
+
|
9
|
+
exempt_tags = ""
|
10
|
+
exempt_tags << "--tags ~@nojava" if RUBY_PLATFORM == "java"
|
11
|
+
|
12
|
+
t.cucumber_opts = "--color --tags ~@wip #{exempt_tags} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
8
13
|
end
|
9
14
|
|
10
15
|
require 'rake/clean'
|
data/features/preview.feature
CHANGED
@@ -29,4 +29,4 @@ Feature: Minify HTML
|
|
29
29
|
"""
|
30
30
|
And a successfully built app at "basic-app"
|
31
31
|
When I cd to "build"
|
32
|
-
Then the file "index.html" should contain "<h1> Multi Line </h1
|
32
|
+
Then the file "index.html" should contain "<h1> Multi Line </h1><h2> Broken Up </h2>"
|
@@ -1,50 +1,20 @@
|
|
1
1
|
module Middleman
|
2
2
|
module MinifyHtml
|
3
3
|
class << self
|
4
|
-
def registered(app)
|
4
|
+
def registered(app, options={})
|
5
5
|
app.set :html_compressor, false
|
6
6
|
|
7
7
|
app.after_configuration do
|
8
8
|
unless respond_to?(:html_compressor) && html_compressor
|
9
|
-
require '
|
10
|
-
set :html_compressor, ::HtmlCompressor::
|
9
|
+
require 'htmlcompressor'
|
10
|
+
set :html_compressor, ::HtmlCompressor::Compressor.new(options)
|
11
11
|
end
|
12
12
|
|
13
13
|
# Setup Rack to watch for inline JS
|
14
|
-
use
|
14
|
+
use ::HtmlCompressor::Rack, options
|
15
15
|
end
|
16
16
|
end
|
17
17
|
alias :included :registered
|
18
18
|
end
|
19
|
-
|
20
|
-
class MinifyHtmlRack
|
21
|
-
|
22
|
-
# Init
|
23
|
-
# @param [Class] app
|
24
|
-
# @param [Hash] options
|
25
|
-
def initialize(app, options={})
|
26
|
-
@app = app
|
27
|
-
@compressor = options[:compressor]
|
28
|
-
end
|
29
|
-
|
30
|
-
# Rack interface
|
31
|
-
# @param [Rack::Environmemt] env
|
32
|
-
# @return [Array]
|
33
|
-
def call(env)
|
34
|
-
status, headers, response = @app.call(env)
|
35
|
-
|
36
|
-
path = env["PATH_INFO"]
|
37
|
-
|
38
|
-
if path.end_with?('.html')
|
39
|
-
uncompressed_source = ::Middleman::Util.extract_response_text(response)
|
40
|
-
minified_html = @compressor.compress(uncompressed_source)
|
41
|
-
|
42
|
-
headers["Content-Length"] = ::Rack::Utils.bytesize(minified_html).to_s
|
43
|
-
response = [minified_html]
|
44
|
-
end
|
45
|
-
|
46
|
-
[status, headers, response]
|
47
|
-
end
|
48
|
-
end
|
49
19
|
end
|
50
20
|
end
|
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.files = `git ls-files`.split("\n")
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
# s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
22
|
s.add_runtime_dependency("middleman-core", [">= 3.0.0.beta.3"])
|
23
|
-
s.add_runtime_dependency("
|
23
|
+
s.add_runtime_dependency("htmlcompressor")
|
24
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-minify-html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.rc.1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|
16
|
-
requirement: &
|
16
|
+
requirement: &70141864374620 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0.beta.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70141864374620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: htmlcompressor
|
27
|
+
requirement: &70141864374200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70141864374200
|
36
36
|
description: A html whitespace minifier for Middleman
|
37
37
|
email:
|
38
38
|
- me@tdreyno.com
|
@@ -69,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
69
|
version: '0'
|
70
70
|
segments:
|
71
71
|
- 0
|
72
|
-
hash:
|
72
|
+
hash: 105983893746764668
|
73
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: 1.3.1
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project: middleman-minify-html
|
81
|
-
rubygems_version: 1.8.
|
81
|
+
rubygems_version: 1.8.11
|
82
82
|
signing_key:
|
83
83
|
specification_version: 3
|
84
84
|
summary: A html whitespace minifier for Middleman
|