middleman-autoprefixer 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/features/support/env.rb +3 -0
- data/lib/middleman-autoprefixer.rb +0 -1
- data/lib/middleman-autoprefixer/extension.rb +22 -26
- data/lib/middleman-autoprefixer/version.rb +1 -1
- data/middleman-autoprefixer.gemspec +2 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bab90f62c77bfe6af78ef51e0922eadee7997851
|
4
|
+
data.tar.gz: 6a1bf62163cd7ba409a60a6d271bc89424e95389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c73adbe40e08aee58a413cfbab05b6b3d18702630b532798b03cc189559200ea1b754327018507ae374a47870a670e410a796303deacc34d7f3c97947787e85
|
7
|
+
data.tar.gz: 361bd92be3288c6efe9a3b65f5649e3034dd0c835e336b5ecdb88813052f9aead258a3880b64f0af6e0a8fcd095d68461bb347cc9868e79d48b5a5a7b66617d4
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Gem version](http://img.shields.io/gem/v/middleman-autoprefixer.svg?style=flat)](http://badge.fury.io/rb/middleman-autoprefixer) [![Build status](http://img.shields.io/travis/porada/middleman-autoprefixer.svg?style=flat)](https://travis-ci.org/porada/middleman-autoprefixer) [![Dependency status](http://img.shields.io/gemnasium/porada/middleman-autoprefixer.svg?style=flat)](https://gemnasium.com/porada/middleman-autoprefixer) [![Code Climate](http://img.shields.io/codeclimate/github/porada/middleman-autoprefixer.svg?style=flat)](https://codeclimate.com/github/porada/middleman-autoprefixer)
|
1
|
+
[![Gem version](http://img.shields.io/gem/v/middleman-autoprefixer.svg?style=flat)](http://badge.fury.io/rb/middleman-autoprefixer) [![Build status](http://img.shields.io/travis/porada/middleman-autoprefixer.svg?style=flat)](https://travis-ci.org/porada/middleman-autoprefixer) [![Coveralls](http://img.shields.io/coveralls/porada/middleman-autoprefixer.svg?style=flat)](https://coveralls.io/r/porada/middleman-autoprefixer) [![Dependency status](http://img.shields.io/gemnasium/porada/middleman-autoprefixer.svg?style=flat)](https://gemnasium.com/porada/middleman-autoprefixer) [![Code Climate](http://img.shields.io/codeclimate/github/porada/middleman-autoprefixer.svg?style=flat)](https://codeclimate.com/github/porada/middleman-autoprefixer)
|
2
2
|
|
3
3
|
# Middleman::Autoprefixer
|
4
4
|
|
data/Rakefile
CHANGED
data/features/support/env.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
2
2
|
ENV['TEST'] = 'true'
|
3
3
|
|
4
|
+
require 'coveralls'
|
5
|
+
Coveralls.wear!
|
6
|
+
|
4
7
|
require 'middleman'
|
5
8
|
require 'middleman-core/step_definitions'
|
6
9
|
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-autoprefixer')
|
@@ -34,8 +34,6 @@ module Middleman
|
|
34
34
|
@cascade = options[:cascade]
|
35
35
|
@inline = options[:inline]
|
36
36
|
@ignore = options[:ignore]
|
37
|
-
|
38
|
-
initialize_autoprefixer
|
39
37
|
end
|
40
38
|
|
41
39
|
# Rack interface
|
@@ -43,21 +41,11 @@ module Middleman
|
|
43
41
|
# @return [Array]
|
44
42
|
def call(env)
|
45
43
|
status, headers, response = @app.call(env)
|
44
|
+
prefixed = process(response, env['PATH_INFO'])
|
46
45
|
|
47
|
-
if
|
48
|
-
prefixed = ::Middleman::Util.extract_response_text(response)
|
49
|
-
|
50
|
-
prefixed.gsub!(INLINE_CSS_REGEX) do
|
51
|
-
$1 << process($2) << $3
|
52
|
-
end
|
53
|
-
|
46
|
+
if prefixed.is_a?(String)
|
54
47
|
headers['Content-Length'] = ::Rack::Utils.bytesize(prefixed).to_s
|
55
48
|
response = [prefixed]
|
56
|
-
elsif standalone_css_content?(env['PATH_INFO'])
|
57
|
-
prefixed_css = process(::Middleman::Util.extract_response_text(response))
|
58
|
-
|
59
|
-
headers['Content-Length'] = ::Rack::Utils.bytesize(prefixed_css).to_s
|
60
|
-
response = [prefixed_css]
|
61
49
|
end
|
62
50
|
|
63
51
|
[status, headers, response]
|
@@ -65,24 +53,32 @@ module Middleman
|
|
65
53
|
|
66
54
|
private
|
67
55
|
|
68
|
-
def
|
56
|
+
def process(response, path)
|
57
|
+
if standalone_css_content?(path)
|
58
|
+
prefix(extract_styles(response))
|
59
|
+
elsif inline_html_content?(path)
|
60
|
+
prefix_inline_styles(extract_styles(response))
|
61
|
+
else
|
62
|
+
nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def prefix(content)
|
69
67
|
config = {}
|
70
68
|
config[:browsers] = Array(@browsers)
|
71
69
|
config[:cascade] = @cascade unless @cascade.nil?
|
72
70
|
|
73
|
-
|
71
|
+
::AutoprefixerRails.process(content, config).css
|
74
72
|
end
|
75
73
|
|
76
|
-
def
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|
74
|
+
def prefix_inline_styles(content)
|
75
|
+
content = content.dup
|
76
|
+
content.gsub!(INLINE_CSS_REGEX) { $1 << prefix($2) << $3 }
|
77
|
+
content
|
78
|
+
end
|
79
|
+
|
80
|
+
def extract_styles(response)
|
81
|
+
::Middleman::Util.extract_response_text(response)
|
86
82
|
end
|
87
83
|
|
88
84
|
def inline_html_content?(path)
|
@@ -17,11 +17,12 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
19
|
spec.add_dependency 'middleman-core', '>= 3.3.3'
|
20
|
-
spec.add_dependency 'autoprefixer-rails', '~> 3.
|
20
|
+
spec.add_dependency 'autoprefixer-rails', '~> 3.1.0'
|
21
21
|
|
22
22
|
spec.add_development_dependency 'middleman', '>= 3.3.3'
|
23
23
|
spec.add_development_dependency 'cucumber', '~> 1.3'
|
24
24
|
spec.add_development_dependency 'aruba', '~> 0.6'
|
25
|
+
spec.add_development_dependency 'coveralls', '~> 0.7'
|
25
26
|
|
26
27
|
spec.add_development_dependency 'bundler', '>= 1.6'
|
27
28
|
spec.add_development_dependency 'rake', '>= 10.3'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-autoprefixer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Porada
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 3.
|
34
|
+
version: 3.1.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 3.
|
41
|
+
version: 3.1.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: middleman
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,6 +81,20 @@ dependencies:
|
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0.6'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: coveralls
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.7'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.7'
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
99
|
name: bundler
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|