sprockets-media_query_combiner 0.0.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.travis.yml +7 -0
- data/CHANGELOG.md +4 -0
- data/lib/sprockets/media_query_combiner/engine.rb +2 -2
- data/lib/sprockets/media_query_combiner/processor.rb +3 -7
- data/lib/sprockets/media_query_combiner/version.rb +1 -1
- data/spec/sprockets/media_query_combiner/processor_spec.rb +13 -11
- data/sprockets-media_query_combiner.gemspec +1 -1
- metadata +25 -24
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
ZjAyOGZiOThhMGM4MTU0MDA3MTRjNDJkMTQ2NGM4MTk3ZTNmNDU4NzZjM2Jm
|
10
|
-
ZDdiMWY2YjdkNThhODk5YzhjMzg2ZDlmNzZiNmM1NjU2Y2YxOGZkNzUwNDkw
|
11
|
-
MzkwOTlkYzdjN2RhNTJkMTU1MWE5OWUyMWIyZDFiY2E1ZDE4YmY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OGRhZmMzMDRjOTgzZGQwNWViMWQ2NzE5ODU5NDdkMTU3MGQxMmVhMGJiNTUx
|
14
|
-
NjFjYzkwOTVhZWUxNzZlOTIzNGYzMDViOTAyYmEzY2U0ZjQwMTZmZDhhMWIy
|
15
|
-
NTQ3MDY4MTIxOTNkZGU1ZmU5ZjE3NjhlYzU0MzFmMjNjYTFiM2Q=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5b05ffacf63cc1b25cf43d4c84343c8eb5fed08d
|
4
|
+
data.tar.gz: 520da5308033eb4480c53d25d767ee082baa73f3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d16ed19ac10d0950540e6bb9483d1b10b9867329c62340692b53a6a64eaa320dec97b3c24afab142b27bda4639cf51dc8b433169f87ffb4ebcd8e4e2e16fe4a1
|
7
|
+
data.tar.gz: 33857c7d71cc364d87943a7b14a5584e09f6564c40aa65df16b9fc2db5834eae6bdcb7c8f5e6db96758a9b4fd403b4d4f001e372fb2c4317d7c155cc8dc0853e
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -5,8 +5,8 @@ if defined?(::Rails)
|
|
5
5
|
module MediaQueryCombiner
|
6
6
|
class Engine < ::Rails::Engine
|
7
7
|
initializer :setup_media_query_combiner, after: 'sprockets.environment', group: :all do |app|
|
8
|
-
|
9
|
-
|
8
|
+
Sprockets.register_postprocessor 'text/css', Sprockets::MediaQueryCombiner::Processor
|
9
|
+
Sprockets.register_bundle_processor 'text/css', Sprockets::MediaQueryCombiner::Processor
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -1,14 +1,10 @@
|
|
1
|
-
require 'tilt'
|
2
1
|
require 'sass/media_query_combiner/combiner'
|
3
2
|
|
4
3
|
module Sprockets
|
5
4
|
module MediaQueryCombiner
|
6
|
-
class Processor
|
7
|
-
def
|
8
|
-
|
9
|
-
|
10
|
-
def evaluate(context, locals, &block)
|
11
|
-
Sass::MediaQueryCombiner::Combiner.combine(data)
|
5
|
+
class Processor
|
6
|
+
def self.call(input)
|
7
|
+
Sass::MediaQueryCombiner::Combiner.combine input[:data]
|
12
8
|
end
|
13
9
|
end
|
14
10
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
+
require 'sprockets'
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'sprockets/media_query_combiner/processor'
|
3
4
|
|
4
5
|
module Sprockets::MediaQueryCombiner
|
5
|
-
|
6
|
-
it "should work with pretty css" do
|
7
|
-
combiner = Processor.new do
|
8
|
-
<<CSS
|
6
|
+
pretty_input_css = <<CSS
|
9
7
|
h3 {
|
10
8
|
color: orange
|
11
9
|
}
|
@@ -31,8 +29,7 @@ b {
|
|
31
29
|
color: yellow
|
32
30
|
}
|
33
31
|
CSS
|
34
|
-
|
35
|
-
combiner.evaluate(nil, nil).should == <<CSS
|
32
|
+
pretty_target_css = <<CSS
|
36
33
|
h3 {
|
37
34
|
color: orange
|
38
35
|
}
|
@@ -57,14 +54,19 @@ b {
|
|
57
54
|
}
|
58
55
|
}
|
59
56
|
CSS
|
57
|
+
ugly_input_css = "h3{color:orange}@media (max-width:480px){h1{color:red}}@media (max-width:980px){h4{color:black}}@media (max-width:480px){h2{color:blue}}\n"
|
58
|
+
ugly_target_css = "h3{color:orange}@media (max-width:480px){h1{color:red}h2{color:blue}}@media (max-width:980px){h4{color:black}}\n"
|
59
|
+
|
60
|
+
|
61
|
+
output = lambda { |input| Processor.call( { data: input } ) }
|
62
|
+
|
63
|
+
describe Processor do
|
64
|
+
it "should work with pretty css" do
|
65
|
+
output[pretty_input_css].should == pretty_target_css
|
60
66
|
end
|
61
67
|
|
62
68
|
it "should work with ugly css" do
|
63
|
-
|
64
|
-
"h3{color:orange}@media (max-width:480px){h1{color:red}}@media (max-width:980px){h4{color:black}}@media (max-width:480px){h2{color:blue}}\n"
|
65
|
-
end
|
66
|
-
combiner.evaluate(nil, nil).should ==
|
67
|
-
"h3{color:orange}@media (max-width:480px){h1{color:red}h2{color:blue}}@media (max-width:980px){h4{color:black}}\n"
|
69
|
+
output[ugly_input_css].should == ugly_target_css
|
68
70
|
end
|
69
71
|
end
|
70
72
|
end
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
|
19
19
|
gem.required_ruby_version = '>= 1.9.2'
|
20
20
|
|
21
|
-
gem.add_runtime_dependency "sprockets", "~>
|
21
|
+
gem.add_runtime_dependency "sprockets", "~> 3.0"
|
22
22
|
gem.add_runtime_dependency "sass-media_query_combiner", "~>0.0.4"
|
23
23
|
|
24
24
|
gem.add_development_dependency "rspec"
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets-media_query_combiner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Jensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|
15
|
-
prerelease: false
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
|
-
- - ~>
|
17
|
+
- - "~>"
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
21
22
|
version_requirements: !ruby/object:Gem::Requirement
|
22
23
|
requirements:
|
23
|
-
- - ~>
|
24
|
+
- - "~>"
|
24
25
|
- !ruby/object:Gem::Version
|
25
|
-
version: '
|
26
|
-
type: :runtime
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sass-media_query_combiner
|
29
|
-
prerelease: false
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
|
-
- - ~>
|
31
|
+
- - "~>"
|
33
32
|
- !ruby/object:Gem::Version
|
34
33
|
version: 0.0.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
35
36
|
version_requirements: !ruby/object:Gem::Requirement
|
36
37
|
requirements:
|
37
|
-
- - ~>
|
38
|
+
- - "~>"
|
38
39
|
- !ruby/object:Gem::Version
|
39
40
|
version: 0.0.4
|
40
|
-
type: :runtime
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
|
-
prerelease: false
|
44
43
|
requirement: !ruby/object:Gem::Requirement
|
45
44
|
requirements:
|
46
|
-
- -
|
45
|
+
- - ">="
|
47
46
|
- !ruby/object:Gem::Version
|
48
47
|
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
49
50
|
version_requirements: !ruby/object:Gem::Requirement
|
50
51
|
requirements:
|
51
|
-
- -
|
52
|
+
- - ">="
|
52
53
|
- !ruby/object:Gem::Version
|
53
54
|
version: '0'
|
54
|
-
type: :development
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
|
-
prerelease: false
|
58
57
|
requirement: !ruby/object:Gem::Requirement
|
59
58
|
requirements:
|
60
|
-
- -
|
59
|
+
- - ">="
|
61
60
|
- !ruby/object:Gem::Version
|
62
61
|
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
63
64
|
version_requirements: !ruby/object:Gem::Requirement
|
64
65
|
requirements:
|
65
|
-
- -
|
66
|
+
- - ">="
|
66
67
|
- !ruby/object:Gem::Version
|
67
68
|
version: '0'
|
68
|
-
type: :development
|
69
69
|
description: Sprockets bundle processor to combine all like media queries
|
70
70
|
email:
|
71
71
|
- aaronjensen@gmail.com
|
@@ -73,7 +73,8 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
77
78
|
- CHANGELOG.md
|
78
79
|
- Gemfile
|
79
80
|
- LICENSE
|
@@ -97,17 +98,17 @@ require_paths:
|
|
97
98
|
- lib
|
98
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
100
|
requirements:
|
100
|
-
- -
|
101
|
+
- - ">="
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
version: 1.9.2
|
103
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
105
|
requirements:
|
105
|
-
- -
|
106
|
+
- - ">="
|
106
107
|
- !ruby/object:Gem::Version
|
107
108
|
version: '0'
|
108
109
|
requirements: []
|
109
110
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.4.8
|
111
112
|
signing_key:
|
112
113
|
specification_version: 4
|
113
114
|
summary: Automatically combine media queries
|