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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2964a92ac49adbda15f2f23a3f96670dfe58fd94
4
- data.tar.gz: 22c60b528fda7e3f7bb3d4c050c831c69d3dfc63
3
+ metadata.gz: bab90f62c77bfe6af78ef51e0922eadee7997851
4
+ data.tar.gz: 6a1bf62163cd7ba409a60a6d271bc89424e95389
5
5
  SHA512:
6
- metadata.gz: 24a95f1f272bcae91f5582c34cf7d7dda51a7a78840041d062a990e30622011bbcd90e8334440a03b652162b3286cbf6edc17cb8f5e4a5159549e9a8d77c4422
7
- data.tar.gz: 85305851ec5f2c3710fbd4c5bed450a9d1c384c50fce67dd342d0e91ce98bfcae0a5d08bcab348eda3feae5becb909708c7459ed461ae08072a0af9bf716a6e7
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
@@ -1,6 +1,8 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'cucumber/rake/task'
3
3
 
4
+ task :default => :test
5
+
4
6
  Cucumber::Rake::Task.new(:test, 'Run features that should pass') do |task|
5
7
  task.cucumber_opts = '--color --tags ~@wip --strict --format pretty'
6
8
  end
@@ -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')
@@ -1,5 +1,4 @@
1
1
  require 'middleman-core'
2
-
3
2
  require_relative 'middleman-autoprefixer/version'
4
3
 
5
4
  ::Middleman::Extensions.register(:autoprefixer) do
@@ -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 inline_html_content?(env['PATH_INFO'])
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 initialize_autoprefixer
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
- @autoprefixer = ::AutoprefixerRails::Processor.new(config)
71
+ ::AutoprefixerRails.process(content, config).css
74
72
  end
75
73
 
76
- def process(content)
77
- begin
78
- @autoprefixer.process(content).css
79
- rescue ExecJS::ProgramError => error
80
- if error.message =~ /Can't parse CSS/
81
- content
82
- else
83
- raise error
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)
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Autoprefixer
3
- VERSION = '2.2.0'.freeze
3
+ VERSION = '2.2.1'.freeze
4
4
  end
5
5
  end
@@ -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.0.0'
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.0
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-08-22 00:00:00.000000000 Z
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.0.0
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.0.0
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