sass-media_query_combiner 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +8 -0
- data/Gemfile +4 -0
- data/README.md +9 -0
- data/Rakefile +5 -0
- data/lib/sass/media_query_combiner/version.rb +1 -1
- data/lib/sass-media_query_combiner.rb +21 -1
- data/sass-media_query_combiner.gemspec +2 -1
- data/spec/sass-media_query_combiner_spec.rb +17 -2
- data/spec/spec_helper.rb +3 -6
- metadata +33 -13
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Sass::MediaQueryCombiner
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/sass-media_query_combiner.png)](http://badge.fury.io/rb/sass-media_query_combiner)
|
4
|
+
[![Build Status](https://travis-ci.org/aaronjensen/sass-media_query_combiner.png)](https://travis-ci.org/aaronjensen/sass-media_query_combiner)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/aaronjensen/sass-media_query_combiner/badge.png?branch=master)](https://coveralls.io/r/aaronjensen/sass-media_query_combiner)
|
6
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/aaronjensen/sass-media_query_combiner)
|
7
|
+
|
3
8
|
Combines all matching media queries while compiling your Sass.
|
4
9
|
|
5
10
|
If you're using
|
@@ -95,3 +100,7 @@ sass --watch -r sass-media_query_combiner
|
|
95
100
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
96
101
|
4. Push to the branch (`git push origin my-new-feature`)
|
97
102
|
5. Create new Pull Request
|
103
|
+
|
104
|
+
|
105
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/aaronjensen/sass-media_query_combiner/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
106
|
+
|
data/Rakefile
CHANGED
@@ -7,7 +7,27 @@ module Sass
|
|
7
7
|
queries = Hash.new { |hash, key| hash[key] = '' }
|
8
8
|
pretty = true
|
9
9
|
|
10
|
-
filtered_data = css.gsub(
|
10
|
+
filtered_data = css.gsub(/
|
11
|
+
\n? # Optional newline
|
12
|
+
(?<query> # The media query parameters, this will be $1
|
13
|
+
@media # Start with @media
|
14
|
+
[^{]+ # One to many characters that are not {, we are guaranteed to have a space
|
15
|
+
)
|
16
|
+
{
|
17
|
+
(?<body> # The actual body, this will be $2
|
18
|
+
(?<braces> # Recursive capture group
|
19
|
+
(?:
|
20
|
+
[^{}]* # Anything that is not a brace
|
21
|
+
)
|
22
|
+
| # OR
|
23
|
+
(
|
24
|
+
{\g<braces>} # Recursively capture things within braces, this allows for balanced braces
|
25
|
+
)
|
26
|
+
)* # As many of these as we have
|
27
|
+
)
|
28
|
+
}
|
29
|
+
\n? # Optional newline
|
30
|
+
/mx) do |match|
|
11
31
|
queries[$1] << $2
|
12
32
|
pretty &&= /\n$/m === match
|
13
33
|
''
|
@@ -19,7 +19,8 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
gem.required_ruby_version = '>= 1.9.2'
|
21
21
|
|
22
|
-
gem.add_runtime_dependency "sass", "
|
22
|
+
gem.add_runtime_dependency "sass", ">=3.2.0"
|
23
23
|
|
24
24
|
gem.add_development_dependency "rspec"
|
25
|
+
gem.add_development_dependency "rake"
|
25
26
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'sass-media_query_combiner'
|
3
3
|
|
4
4
|
describe "Combiner" do
|
5
|
-
it "should with sass" do
|
5
|
+
it "should work with sass" do
|
6
6
|
sass = <<SASS
|
7
7
|
h3
|
8
8
|
color: orange
|
@@ -23,6 +23,8 @@ b
|
|
23
23
|
color: yellow
|
24
24
|
SASS
|
25
25
|
|
26
|
+
# NOTE: the weird interpolated space in there is required to match.
|
27
|
+
# My editor strips out trailing whitespace, so that's how I get it to stay.
|
26
28
|
Sass::Engine.new(sass).render.should == <<CSS
|
27
29
|
h3 {
|
28
30
|
color: orange; }
|
@@ -31,7 +33,7 @@ b {
|
|
31
33
|
|
32
34
|
@media (max-width: 480px) {
|
33
35
|
h1 {
|
34
|
-
color: red; }
|
36
|
+
color: red; }#{" "}
|
35
37
|
h2 {
|
36
38
|
color: blue; } }
|
37
39
|
|
@@ -41,3 +43,16 @@ b {
|
|
41
43
|
CSS
|
42
44
|
end
|
43
45
|
end
|
46
|
+
|
47
|
+
describe Sass::MediaQueryCombiner do
|
48
|
+
it "should handle keyframes in media queries" do
|
49
|
+
Timeout::timeout(0.5) do
|
50
|
+
Sass::MediaQueryCombiner.combine <<CSS
|
51
|
+
@media (min-width: 40em) {
|
52
|
+
@-webkit-keyframes whatever {}
|
53
|
+
}
|
54
|
+
CSS
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
# loaded once.
|
5
|
-
#
|
6
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
7
4
|
RSpec.configure do |config|
|
8
5
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
6
|
config.run_all_when_everything_filtered = true
|
metadata
CHANGED
@@ -1,48 +1,64 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-media_query_combiner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2
|
5
4
|
prerelease:
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Aaron Jensen
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sass
|
16
|
+
type: :runtime
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 3.2.0
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
22
|
none: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
24
|
requirements:
|
27
|
-
- -
|
25
|
+
- - ! '>='
|
28
26
|
- !ruby/object:Gem::Version
|
29
27
|
version: 3.2.0
|
28
|
+
none: false
|
29
|
+
prerelease: false
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rspec
|
32
|
+
type: :development
|
32
33
|
requirement: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
33
38
|
none: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
34
40
|
requirements:
|
35
41
|
- - ! '>='
|
36
42
|
- !ruby/object:Gem::Version
|
37
43
|
version: '0'
|
38
|
-
|
44
|
+
none: false
|
39
45
|
prerelease: false
|
40
|
-
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
type: :development
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
41
54
|
none: false
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
56
|
requirements:
|
43
57
|
- - ! '>='
|
44
58
|
- !ruby/object:Gem::Version
|
45
59
|
version: '0'
|
60
|
+
none: false
|
61
|
+
prerelease: false
|
46
62
|
description: Automatically combine media queries
|
47
63
|
email:
|
48
64
|
- aaronjensen@gmail.com
|
@@ -51,6 +67,7 @@ extensions: []
|
|
51
67
|
extra_rdoc_files: []
|
52
68
|
files:
|
53
69
|
- .gitignore
|
70
|
+
- CHANGELOG.md
|
54
71
|
- Gemfile
|
55
72
|
- LICENSE.txt
|
56
73
|
- README.md
|
@@ -67,20 +84,23 @@ rdoc_options: []
|
|
67
84
|
require_paths:
|
68
85
|
- lib
|
69
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
87
|
requirements:
|
72
88
|
- - ! '>='
|
73
89
|
- !ruby/object:Gem::Version
|
74
90
|
version: 1.9.2
|
75
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
91
|
none: false
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
93
|
requirements:
|
78
94
|
- - ! '>='
|
79
95
|
- !ruby/object:Gem::Version
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
hash: -4365844637622836059
|
80
99
|
version: '0'
|
100
|
+
none: false
|
81
101
|
requirements: []
|
82
102
|
rubyforge_project:
|
83
|
-
rubygems_version: 1.8.
|
103
|
+
rubygems_version: 1.8.25
|
84
104
|
signing_key:
|
85
105
|
specification_version: 3
|
86
106
|
summary: Sass plugin to combine all like media queries
|