responder 0.0.1.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ test/.sass-cache/*
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in responder.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Daniel Guillan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # Responder
2
+
3
+ Magic media queries for your Compass project. You define the breakpoints, Responder takes care of the rest.
4
+
5
+ Forget about multiple variable declarations, long lists of unmanageable, inextensible and unreusable mixins. Responder is the only media queries mixin you'll ever need. And it's always ready to use.
6
+
7
+ ## Installation
8
+
9
+ Install the respond-to gem:
10
+
11
+ $ gem install responder
12
+
13
+ In your project's config.rb file add:
14
+
15
+ require "responder"
16
+
17
+ Finally install the Compass extension:
18
+
19
+ $ compass install responder
20
+
21
+ ## Usage
22
+
23
+ ### 1. Define your own breakpoints
24
+
25
+ Include the `respond-to-breakpoints()` mixin in your stylesheet and pass a list of desired breakpoints. Define as many as you need and give each one of them a name and a min-width value.
26
+
27
+ *An example:*
28
+
29
+ @include respond-to-breakpoints( mobile-portrait 320px,
30
+ mobile-landscape 480px,
31
+ tablet-portrait 600px,
32
+ tablet-landscape 768px,
33
+ desktop 990px);
34
+
35
+ **Important:** Your list of breakpoints must always start with the smallest breakpoint and end with the bigger one.
36
+
37
+ ### 2. Using the respond-to mixin
38
+
39
+ Yep, that was it. Your mixin is ready to use.
40
+
41
+ This is how you use respond-to in your SASS stylesheet:
42
+
43
+ selector {
44
+ @include respond-to(breakpointName-extend) {
45
+ // rules…
46
+ }
47
+ }
48
+ For each breakpoint you've defined you now have 3 available parameters for the respond-to mixin:
49
+
50
+ - *breakpointName***-only**
51
+ - *breakpointName***-and-up**
52
+ - *breakpointName***-and-below**
53
+
54
+ *An example:*
55
+
56
+ body {
57
+ background-color: #fff;
58
+
59
+ // Targets tablet-landscape only
60
+ @include respond-to(tablet-landscape-only) {
61
+ background-color: #0f0;
62
+ }
63
+
64
+ // Targets tablet-portrait and up
65
+ @include respond-to(tablet-portrait-and-up) {
66
+ background-color: #ff0;
67
+ }
68
+
69
+ // Targets mobile-landscape and below
70
+ @include respond-to(mobile-landscape-and-below) {
71
+ background-color: #0ff;
72
+ }
73
+
74
+ // (Bonus!) Targets mobile only
75
+ @include respond-to(mobile-only) {
76
+ background: #f0f;
77
+ }
78
+ }
79
+
80
+
81
+ #### Breakpoint Groups
82
+
83
+ You might have noticed from the example above that we where able to `respond-to(mobile-only)`, but how? We didn't define any mobile (only) breakpoint in our list. Well, that's some of the magic behind Responder. It automatically creates breakpoint groups based on your breakpoint names.
84
+
85
+ Groups are sets of breakpoints whose names share the same root followed by a dash (-). For example `mobile` is the group Responder creates for the `mobile-portrait` and `mobile-landscape` breakpoints.
86
+
87
+ Given the example breakpoint list above, `respond-to(mobile-only)` will output the following css:
88
+
89
+ @media screen and (min-width: 320px) and (max-width: 480px) { … }
90
+
91
+ min-width value is the first breakpoint of the group and max-width is the last one. It's that simple.
92
+
93
+ **NOTE:** You can define more than two breakpoints per group, Responder will pick the smallest breakpoint and the bigger breakpoint to create the group.
94
+
95
+ ### 3. There's no #3. Enjoy and build amazing stuff
96
+
97
+ … And contribute to make Responder even better!
98
+
99
+
100
+ ## What's next?
101
+
102
+ - Respond-to Retina displays
103
+ - Support for more than just `min-width` and `max-width`
104
+ - Suggestions?
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module Responder
2
+ VERSION = "0.0.1.alpha.1"
3
+ end
data/lib/responder.rb ADDED
@@ -0,0 +1,19 @@
1
+ root = File.join(File.dirname(__FILE__), "..")
2
+
3
+ require "responder/version"
4
+ require "compass"
5
+
6
+ module Sass::Script::Functions
7
+ def regex(string,regex)
8
+ assert_type string, :String
9
+ assert_type regex, :String
10
+ /#{regex.value}/.match string.value
11
+ $1 ? match = $1 : match = ''
12
+ Sass::Script::String.new(match)
13
+ end
14
+ declare :regex, :args => [:string, :string]
15
+ end
16
+
17
+ Compass::Frameworks.register("responder",
18
+ :stylesheets_directory => File.join(root,"scss")
19
+ )
data/responder.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'responder/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "responder"
8
+ gem.version = Responder::VERSION
9
+ gem.authors = ["Daniel Guillan"]
10
+ gem.email = ["daniel.guillan@gmail.com"]
11
+ gem.description = %q{Magic media queries for your Compass project}
12
+ gem.summary = %q{Magic media queries for your Compass project}
13
+ gem.homepage = "http://github.com/danielguillan/responder"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+
19
+ gem.add_dependency "sass", [">= 3.2.0"]
20
+ gem.add_dependency "compass", [">= 0.12.2"]
21
+ gem.add_dependency "rake"
22
+
23
+ end
@@ -0,0 +1,117 @@
1
+ // =============================================================================
2
+ // Functions
3
+ //
4
+ // Table of contents:
5
+ // 1. Get breakpoint Names list
6
+ // 2. Get breakpoint Values list
7
+ // 3. Get breakpoint Groups list with min and max values
8
+ // 4. Get the Respond-to breakpoint
9
+ //
10
+ // =============================================================================
11
+
12
+ // =============================================================================
13
+ // 1. Get breakpoint Names list
14
+ // =============================================================================
15
+
16
+ @function getBreakpointNames($breakpoints) {
17
+ $names: ();
18
+ @for $i from 1 through length($breakpoints) {
19
+ @if type-of(nth(nth($breakpoints,$i),1)) == string {
20
+ $names: join($names, nth(nth($breakpoints,$i),1));
21
+ } @else {
22
+ @warn '[ERROR] "' + nth(nth($breakpoints,$i),1) + '" is not a valid breakipoint name';
23
+ }
24
+ }
25
+ @return $names;
26
+ }
27
+
28
+ // =============================================================================
29
+ // 2. Get breakpoint Values list
30
+ // =============================================================================
31
+
32
+ @function getBreakpointValues($breakpoints) {
33
+ $values: ();
34
+ @for $i from 1 through length($breakpoints) {
35
+ @if type-of(nth(nth($breakpoints,$i),2)) == number {
36
+ $values: join($values, nth(nth($breakpoints,$i),2));
37
+ } @else {
38
+ @warn '[ERROR] "' + nth(nth($breakpoints,$i),2) + '" is not a valid breakipoint value';
39
+ }
40
+ }
41
+ @return $values;
42
+ }
43
+
44
+ // =============================================================================
45
+ // 3. Get breakpoint Groups list with min and max values
46
+ // =============================================================================
47
+
48
+ @function createBreakpointGroups($breakpoint-names, $breakpoint-values) {
49
+ $groups: ();
50
+ $total-groups: 0;
51
+ $last: 0;
52
+
53
+ @for $i from 1 through length($breakpoint-names) {
54
+ $group: regex(nth($breakpoint-names,$i), '([a-z]+)?\-');
55
+ $repeated: false;
56
+
57
+ @if $group != '' {
58
+
59
+ // Check if we already found this group
60
+ @each $saved-group in $groups {
61
+ @if $group == nth($saved-group, 1) {
62
+ $repeated: true;
63
+ }
64
+ }
65
+
66
+ // If this is a new group add it to the list
67
+ @if $repeated != true {
68
+ $group: join($group, nth($breakpoint-values, $i) nth($breakpoint-values, ($i + 2)), space);
69
+ $groups: append($groups, $group , comma );
70
+ $total-groups: $total-groups + 1;
71
+ }
72
+ }
73
+ }
74
+
75
+ @return $groups;
76
+ }
77
+
78
+ // =============================================================================
79
+ // 4. Get the Respond-to breakpoint
80
+ // =============================================================================
81
+
82
+ @function getBreakpointInfo($breakpoint) {
83
+
84
+ // capture the extend (only, and-up or and-below)
85
+ $extend: regex($breakpoint, '((and-)?[a-z]+)$');
86
+
87
+ // capture the breakpoint name
88
+ $root: regex($breakpoint, '(.*?)-'+ $extend + '$');
89
+
90
+ // Check if it's a normal breakpoint
91
+ @for $i from 1 through length($breakpoint-names) {
92
+
93
+ @if $root == nth($breakpoint-names, $i) {
94
+ $group: false;
95
+ $groupid: false;
96
+ $br: join($root, $extend, space);
97
+ $br: join($br, $group, space);
98
+ $br: join($br, $groupid, space);
99
+ @return $br;
100
+ }
101
+ }
102
+
103
+ // Check if it's a group
104
+ @for $i from 1 through length($breakpoint-groups) {
105
+ @if $root == nth(nth($breakpoint-groups, $i),1) {
106
+ $group: true;
107
+ $groupid: $i;
108
+ $br: join($root, $extend, space);
109
+ $br: join($br, $group, space);
110
+ $br: join($br, $groupid, space);
111
+ @return $br;
112
+ }
113
+ }
114
+
115
+ @warn '[ERROR] "' + $breakpoint + '"" is not a valid parameter. Please, check the breakpoint name and also make sure you used -only, -and-up, or -and-below]';
116
+ @return 'error';
117
+ }
@@ -0,0 +1,87 @@
1
+ // =============================================================================
2
+ // Media Queries
3
+ //
4
+ // Magic media queries for your Compass project. You define the breakpoints,
5
+ // Respond-to takes care of the rest.
6
+ //
7
+ // More info, installation and usage:
8
+ // https://github.com/danielguillan/respond-to
9
+ //
10
+ // Table of contents:
11
+ // 1. Variables
12
+ // 2. Initialization
13
+ // 3. Breakpoint Groups
14
+ // 4. Respond-to mixin
15
+ //
16
+ // =============================================================================
17
+
18
+ @import 'functions';
19
+
20
+ // =============================================================================
21
+ // 1. Variables
22
+ // =============================================================================
23
+
24
+ $breakpoint-names: ();
25
+ $breakpoint-values: ();
26
+ $breakpoint-groups: ();
27
+
28
+ // =============================================================================
29
+ // 2. Initialization
30
+ // =============================================================================
31
+
32
+ @mixin respond-to-breakpoints($breakpoints...) {
33
+
34
+ @if length($breakpoints) > 1 {
35
+ $breakpoint-names: getBreakpointNames($breakpoints);
36
+ $breakpoint-values: getBreakpointValues($breakpoints);
37
+ $breakpoint-groups: createBreakpointGroups($breakpoint-names,$breakpoint-values);
38
+ }@else {
39
+ @warn 'respond-to-breakpoints requires at least 2 breakpoints';
40
+ }
41
+ }
42
+
43
+ // =============================================================================
44
+ // 3. Respond-to mixin
45
+ // =============================================================================
46
+
47
+ @mixin respond-to($breakpoint) {
48
+
49
+ $breakpoint-info: getBreakpointInfo($breakpoint);
50
+
51
+ @if $breakpoint-info == 'error' {
52
+ @warn '[ERROR] Invalid breakpoint paramenter';
53
+ } @else {
54
+ $breakpoint-name: nth($breakpoint-info, 1);
55
+ $breakpoint-extend: nth($breakpoint-info, 2);
56
+ $breakpoint-group: nth($breakpoint-info, 3);
57
+ $breakpoint-group-id: nth($breakpoint-info, 4);
58
+
59
+ $min-width: 0;
60
+ $max-width: 0;
61
+
62
+ // If it's a regular breakpoint
63
+ @if $breakpoint-group == false {
64
+ $min-width: nth($breakpoint-values, index($breakpoint-names, $breakpoint-name));
65
+
66
+ // Only set a max-width if it's not the last breakpoint
67
+ @if (index($breakpoint-names, $breakpoint-name) + 1) <= length($breakpoint-values) {
68
+ $max-width: nth($breakpoint-values, (index($breakpoint-names, $breakpoint-name) + 1));
69
+ } @else {
70
+ $breakpoint-extend: and-up;
71
+ }
72
+
73
+ // If it's a breakpoint group
74
+ }@else {
75
+ $min-width: nth( nth($breakpoint-groups, $breakpoint-group-id), 2);
76
+ $max-width: nth( nth($breakpoint-groups, $breakpoint-group-id), 3);
77
+ }
78
+
79
+ @if $breakpoint-extend == only {
80
+ @media (min-width: $min-width) and (max-width: $max-width) { @content; }
81
+ } @else if $breakpoint-extend == and-up {
82
+ @media (min-width: $min-width) { @content; }
83
+ } @else if $breakpoint-extend == and-below {
84
+ @media (max-width: $max-width) { @content; }
85
+ }
86
+ }
87
+ }
data/test/config.rb ADDED
@@ -0,0 +1,10 @@
1
+ require File.join(File.dirname(__FILE__),"../lib/responder")
2
+
3
+ project_type = :stand_alone
4
+ http_path = "/"
5
+ sass_dir = "scss"
6
+ css_dir = "css"
7
+ images_dir = "img"
8
+
9
+ preferred_syntax = :scss
10
+ relative_assets = true
@@ -0,0 +1,340 @@
1
+ /* line 17, ../scss/style.scss */
2
+ body {
3
+ font: 16px/21px "Helvetica Neue", Arial, sans-serif;
4
+ }
5
+
6
+ /* line 21, ../scss/style.scss */
7
+ .wrapper {
8
+ margin: 0 auto;
9
+ padding: 0 1em;
10
+ max-width: 1000px;
11
+ }
12
+
13
+ /* line 40, ../scss/style.scss */
14
+ .mq-mixins-test {
15
+ width: 100%;
16
+ }
17
+ /* line 46, ../scss/style.scss */
18
+ .mq-mixins-test tbody .response-example {
19
+ text-align: center;
20
+ color: #ccc;
21
+ }
22
+ /* line 49, ../scss/style.scss */
23
+ .mq-mixins-test tbody .response-example .isResponding {
24
+ display: none;
25
+ }
26
+ @media (min-width: 320px) and (max-width: 600px) {
27
+ /* line 55, ../scss/style.scss */
28
+ .mq-mixins-test tbody .respond-to-mobile {
29
+ background: #a7e040;
30
+ color: white;
31
+ }
32
+ /* line 36, ../scss/style.scss */
33
+ .mq-mixins-test tbody .respond-to-mobile .isResponding {
34
+ display: inline;
35
+ }
36
+ /* line 37, ../scss/style.scss */
37
+ .mq-mixins-test tbody .respond-to-mobile .isInactive {
38
+ display: none;
39
+ }
40
+ }
41
+ @media (min-width: 320px) and (max-width: 480px) {
42
+ /* line 60, ../scss/style.scss */
43
+ .mq-mixins-test tbody .respond-to-mobile-portrait {
44
+ background: #a7e040;
45
+ color: white;
46
+ }
47
+ /* line 36, ../scss/style.scss */
48
+ .mq-mixins-test tbody .respond-to-mobile-portrait .isResponding {
49
+ display: inline;
50
+ }
51
+ /* line 37, ../scss/style.scss */
52
+ .mq-mixins-test tbody .respond-to-mobile-portrait .isInactive {
53
+ display: none;
54
+ }
55
+ }
56
+ @media (min-width: 480px) and (max-width: 600px) {
57
+ /* line 65, ../scss/style.scss */
58
+ .mq-mixins-test tbody .respond-to-mobile-landscape {
59
+ background: #a7e040;
60
+ color: white;
61
+ }
62
+ /* line 36, ../scss/style.scss */
63
+ .mq-mixins-test tbody .respond-to-mobile-landscape .isResponding {
64
+ display: inline;
65
+ }
66
+ /* line 37, ../scss/style.scss */
67
+ .mq-mixins-test tbody .respond-to-mobile-landscape .isInactive {
68
+ display: none;
69
+ }
70
+ }
71
+ @media (min-width: 600px) and (max-width: 992px) {
72
+ /* line 71, ../scss/style.scss */
73
+ .mq-mixins-test tbody .respond-to-tablet {
74
+ background: #a7e040;
75
+ color: white;
76
+ }
77
+ /* line 36, ../scss/style.scss */
78
+ .mq-mixins-test tbody .respond-to-tablet .isResponding {
79
+ display: inline;
80
+ }
81
+ /* line 37, ../scss/style.scss */
82
+ .mq-mixins-test tbody .respond-to-tablet .isInactive {
83
+ display: none;
84
+ }
85
+ }
86
+ @media (min-width: 600px) and (max-width: 768px) {
87
+ /* line 77, ../scss/style.scss */
88
+ .mq-mixins-test tbody .respond-to-tablet-portrait {
89
+ background: #a7e040;
90
+ color: white;
91
+ }
92
+ /* line 36, ../scss/style.scss */
93
+ .mq-mixins-test tbody .respond-to-tablet-portrait .isResponding {
94
+ display: inline;
95
+ }
96
+ /* line 37, ../scss/style.scss */
97
+ .mq-mixins-test tbody .respond-to-tablet-portrait .isInactive {
98
+ display: none;
99
+ }
100
+ }
101
+ @media (min-width: 768px) and (max-width: 992px) {
102
+ /* line 83, ../scss/style.scss */
103
+ .mq-mixins-test tbody .respond-to-tablet-landscape {
104
+ background: #a7e040;
105
+ color: white;
106
+ }
107
+ /* line 36, ../scss/style.scss */
108
+ .mq-mixins-test tbody .respond-to-tablet-landscape .isResponding {
109
+ display: inline;
110
+ }
111
+ /* line 37, ../scss/style.scss */
112
+ .mq-mixins-test tbody .respond-to-tablet-landscape .isInactive {
113
+ display: none;
114
+ }
115
+ }
116
+ @media (min-width: 992px) {
117
+ /* line 89, ../scss/style.scss */
118
+ .mq-mixins-test tbody .respond-to-desktop {
119
+ background: #a7e040;
120
+ color: white;
121
+ }
122
+ /* line 36, ../scss/style.scss */
123
+ .mq-mixins-test tbody .respond-to-desktop .isResponding {
124
+ display: inline;
125
+ }
126
+ /* line 37, ../scss/style.scss */
127
+ .mq-mixins-test tbody .respond-to-desktop .isInactive {
128
+ display: none;
129
+ }
130
+ }
131
+ @media (min-width: 320px) {
132
+ /* line 98, ../scss/style.scss */
133
+ .mq-mixins-test tbody .respond-to-mobile-and-up {
134
+ background: #a7e040;
135
+ color: white;
136
+ }
137
+ /* line 36, ../scss/style.scss */
138
+ .mq-mixins-test tbody .respond-to-mobile-and-up .isResponding {
139
+ display: inline;
140
+ }
141
+ /* line 37, ../scss/style.scss */
142
+ .mq-mixins-test tbody .respond-to-mobile-and-up .isInactive {
143
+ display: none;
144
+ }
145
+ }
146
+ @media (min-width: 320px) {
147
+ /* line 103, ../scss/style.scss */
148
+ .mq-mixins-test tbody .respond-to-mobile-portrait-and-up {
149
+ background: #a7e040;
150
+ color: white;
151
+ }
152
+ /* line 36, ../scss/style.scss */
153
+ .mq-mixins-test tbody .respond-to-mobile-portrait-and-up .isResponding {
154
+ display: inline;
155
+ }
156
+ /* line 37, ../scss/style.scss */
157
+ .mq-mixins-test tbody .respond-to-mobile-portrait-and-up .isInactive {
158
+ display: none;
159
+ }
160
+ }
161
+ @media (min-width: 480px) {
162
+ /* line 108, ../scss/style.scss */
163
+ .mq-mixins-test tbody .respond-to-mobile-landscape-and-up {
164
+ background: #a7e040;
165
+ color: white;
166
+ }
167
+ /* line 36, ../scss/style.scss */
168
+ .mq-mixins-test tbody .respond-to-mobile-landscape-and-up .isResponding {
169
+ display: inline;
170
+ }
171
+ /* line 37, ../scss/style.scss */
172
+ .mq-mixins-test tbody .respond-to-mobile-landscape-and-up .isInactive {
173
+ display: none;
174
+ }
175
+ }
176
+ @media (min-width: 600px) {
177
+ /* line 114, ../scss/style.scss */
178
+ .mq-mixins-test tbody .respond-to-tablet-and-up {
179
+ background: #a7e040;
180
+ color: white;
181
+ }
182
+ /* line 36, ../scss/style.scss */
183
+ .mq-mixins-test tbody .respond-to-tablet-and-up .isResponding {
184
+ display: inline;
185
+ }
186
+ /* line 37, ../scss/style.scss */
187
+ .mq-mixins-test tbody .respond-to-tablet-and-up .isInactive {
188
+ display: none;
189
+ }
190
+ }
191
+ @media (min-width: 600px) {
192
+ /* line 120, ../scss/style.scss */
193
+ .mq-mixins-test tbody .respond-to-tablet-portrait-and-up {
194
+ background: #a7e040;
195
+ color: white;
196
+ }
197
+ /* line 36, ../scss/style.scss */
198
+ .mq-mixins-test tbody .respond-to-tablet-portrait-and-up .isResponding {
199
+ display: inline;
200
+ }
201
+ /* line 37, ../scss/style.scss */
202
+ .mq-mixins-test tbody .respond-to-tablet-portrait-and-up .isInactive {
203
+ display: none;
204
+ }
205
+ }
206
+ @media (min-width: 768px) {
207
+ /* line 126, ../scss/style.scss */
208
+ .mq-mixins-test tbody .respond-to-tablet-landscape-and-up {
209
+ background: #a7e040;
210
+ color: white;
211
+ }
212
+ /* line 36, ../scss/style.scss */
213
+ .mq-mixins-test tbody .respond-to-tablet-landscape-and-up .isResponding {
214
+ display: inline;
215
+ }
216
+ /* line 37, ../scss/style.scss */
217
+ .mq-mixins-test tbody .respond-to-tablet-landscape-and-up .isInactive {
218
+ display: none;
219
+ }
220
+ }
221
+ @media (min-width: 992px) {
222
+ /* line 132, ../scss/style.scss */
223
+ .mq-mixins-test tbody .respond-to-desktop-and-up {
224
+ background: #a7e040;
225
+ color: white;
226
+ }
227
+ /* line 36, ../scss/style.scss */
228
+ .mq-mixins-test tbody .respond-to-desktop-and-up .isResponding {
229
+ display: inline;
230
+ }
231
+ /* line 37, ../scss/style.scss */
232
+ .mq-mixins-test tbody .respond-to-desktop-and-up .isInactive {
233
+ display: none;
234
+ }
235
+ }
236
+ @media (max-width: 600px) {
237
+ /* line 141, ../scss/style.scss */
238
+ .mq-mixins-test tbody .respond-to-mobile-and-below {
239
+ background: #a7e040;
240
+ color: white;
241
+ }
242
+ /* line 36, ../scss/style.scss */
243
+ .mq-mixins-test tbody .respond-to-mobile-and-below .isResponding {
244
+ display: inline;
245
+ }
246
+ /* line 37, ../scss/style.scss */
247
+ .mq-mixins-test tbody .respond-to-mobile-and-below .isInactive {
248
+ display: none;
249
+ }
250
+ }
251
+ @media (max-width: 480px) {
252
+ /* line 146, ../scss/style.scss */
253
+ .mq-mixins-test tbody .respond-to-mobile-portrait-and-below {
254
+ background: #a7e040;
255
+ color: white;
256
+ }
257
+ /* line 36, ../scss/style.scss */
258
+ .mq-mixins-test tbody .respond-to-mobile-portrait-and-below .isResponding {
259
+ display: inline;
260
+ }
261
+ /* line 37, ../scss/style.scss */
262
+ .mq-mixins-test tbody .respond-to-mobile-portrait-and-below .isInactive {
263
+ display: none;
264
+ }
265
+ }
266
+ @media (max-width: 600px) {
267
+ /* line 151, ../scss/style.scss */
268
+ .mq-mixins-test tbody .respond-to-mobile-landscape-and-below {
269
+ background: #a7e040;
270
+ color: white;
271
+ }
272
+ /* line 36, ../scss/style.scss */
273
+ .mq-mixins-test tbody .respond-to-mobile-landscape-and-below .isResponding {
274
+ display: inline;
275
+ }
276
+ /* line 37, ../scss/style.scss */
277
+ .mq-mixins-test tbody .respond-to-mobile-landscape-and-below .isInactive {
278
+ display: none;
279
+ }
280
+ }
281
+ @media (max-width: 992px) {
282
+ /* line 157, ../scss/style.scss */
283
+ .mq-mixins-test tbody .respond-to-tablet-and-below {
284
+ background: #a7e040;
285
+ color: white;
286
+ }
287
+ /* line 36, ../scss/style.scss */
288
+ .mq-mixins-test tbody .respond-to-tablet-and-below .isResponding {
289
+ display: inline;
290
+ }
291
+ /* line 37, ../scss/style.scss */
292
+ .mq-mixins-test tbody .respond-to-tablet-and-below .isInactive {
293
+ display: none;
294
+ }
295
+ }
296
+ @media (max-width: 768px) {
297
+ /* line 163, ../scss/style.scss */
298
+ .mq-mixins-test tbody .respond-to-tablet-portrait-and-below {
299
+ background: #a7e040;
300
+ color: white;
301
+ }
302
+ /* line 36, ../scss/style.scss */
303
+ .mq-mixins-test tbody .respond-to-tablet-portrait-and-below .isResponding {
304
+ display: inline;
305
+ }
306
+ /* line 37, ../scss/style.scss */
307
+ .mq-mixins-test tbody .respond-to-tablet-portrait-and-below .isInactive {
308
+ display: none;
309
+ }
310
+ }
311
+ @media (max-width: 992px) {
312
+ /* line 169, ../scss/style.scss */
313
+ .mq-mixins-test tbody .respond-to-tablet-landscape-and-below {
314
+ background: #a7e040;
315
+ color: white;
316
+ }
317
+ /* line 36, ../scss/style.scss */
318
+ .mq-mixins-test tbody .respond-to-tablet-landscape-and-below .isResponding {
319
+ display: inline;
320
+ }
321
+ /* line 37, ../scss/style.scss */
322
+ .mq-mixins-test tbody .respond-to-tablet-landscape-and-below .isInactive {
323
+ display: none;
324
+ }
325
+ }
326
+ @media (min-width: 992px) {
327
+ /* line 175, ../scss/style.scss */
328
+ .mq-mixins-test tbody .respond-to-desktop-and-below {
329
+ background: #a7e040;
330
+ color: white;
331
+ }
332
+ /* line 36, ../scss/style.scss */
333
+ .mq-mixins-test tbody .respond-to-desktop-and-below .isResponding {
334
+ display: inline;
335
+ }
336
+ /* line 37, ../scss/style.scss */
337
+ .mq-mixins-test tbody .respond-to-desktop-and-below .isInactive {
338
+ display: none;
339
+ }
340
+ }
data/test/index.html ADDED
@@ -0,0 +1,141 @@
1
+ <!DOCTYPE HTML>
2
+ <html lang="en-US">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Responder testing</title>
7
+ <link href="/css/style.css" rel="stylesheet">
8
+ </head>
9
+ <body>
10
+ <div class="wrapper">
11
+
12
+ <header>
13
+ <h1>Responder mixin testing</h1>
14
+ </header>
15
+
16
+ <h2>Only</h2>
17
+ <table class="mq-mixins-test">
18
+ <thead>
19
+ <tr>
20
+ <th>Mixin</th>
21
+ <th>Response</th>
22
+ </tr>
23
+ </thead>
24
+ <tbody>
25
+ <tr>
26
+ <td><code class="language-css">respond-to(mobile-only)</code></td>
27
+ <td class="response-example respond-to-mobile"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
28
+ </tr>
29
+ <tr>
30
+ <td><code class="language-css">respond-to(mobile-portrait-only)</code></td>
31
+ <td class="response-example respond-to-mobile-portrait"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
32
+ </tr>
33
+ <tr>
34
+ <td><code class="language-css">respond-to(mobile-landscape-only)</code></td>
35
+ <td class="response-example respond-to-mobile-landscape"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
36
+ </tr>
37
+ <tr>
38
+ <td><code class="language-css">respond-to(tablet-only)</code></td>
39
+ <td class="response-example respond-to-tablet"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
40
+ </tr>
41
+ <tr>
42
+ <td><code class="language-css">respond-to(tablet-portrait-only)</code></td>
43
+ <td class="response-example respond-to-tablet-portrait"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
44
+ </tr>
45
+ <tr>
46
+ <td><code class="language-css">respond-to(tablet-landscape-only)</code></td>
47
+ <td class="response-example respond-to-tablet-landscape"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
48
+ </tr>
49
+ <tr>
50
+ <td><code class="language-css">respond-to(desktop-only)</code></td>
51
+ <td class="response-example respond-to-desktop"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
52
+ </tr>
53
+ </tbody>
54
+ </table>
55
+
56
+ <hr>
57
+
58
+ <h2>And-Up</h2>
59
+ <table class="mq-mixins-test">
60
+ <thead>
61
+ <tr>
62
+ <th>Mixin</th>
63
+ <th>Response</th>
64
+ </tr>
65
+ </thead>
66
+ <tbody>
67
+ <tr>
68
+ <td><code class="language-css">respond-to(mobile-and-up)</code></td>
69
+ <td class="response-example respond-to-mobile-and-up"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
70
+ </tr>
71
+ <tr>
72
+ <td><code class="language-css">respond-to(mobile-portrait-and-up)</code></td>
73
+ <td class="response-example respond-to-mobile-portrait-and-up"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
74
+ </tr>
75
+ <tr>
76
+ <td><code class="language-css">respond-to(mobile-landscape-and-up)</code></td>
77
+ <td class="response-example respond-to-mobile-landscape-and-up"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
78
+ </tr>
79
+ <tr>
80
+ <td><code class="language-css">respond-to(tablet-and-up)</code></td>
81
+ <td class="response-example respond-to-tablet-and-up"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
82
+ </tr>
83
+ <tr>
84
+ <td><code class="language-css">respond-to(tablet-portrait-and-up)</code></td>
85
+ <td class="response-example respond-to-tablet-portrait-and-up"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
86
+ </tr>
87
+ <tr>
88
+ <td><code class="language-css">respond-to(tablet-landscape-and-up)</code></td>
89
+ <td class="response-example respond-to-tablet-landscape-and-up"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
90
+ </tr>
91
+ <tr>
92
+ <td><code class="language-css">respond-to(desktop-and-up)</code></td>
93
+ <td class="response-example respond-to-desktop-and-up"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
94
+ </tr>
95
+ </tbody>
96
+ </table>
97
+
98
+ <hr>
99
+
100
+ <h2>And-Below</h2>
101
+ <table class="mq-mixins-test">
102
+ <thead>
103
+ <tr>
104
+ <th>Mixin</th>
105
+ <th>Response</th>
106
+ </tr>
107
+ </thead>
108
+ <tbody>
109
+ <tr>
110
+ <td><code class="language-css">respond-to(mobile-and-below)</code></td>
111
+ <td class="response-example respond-to-mobile-and-below"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
112
+ </tr>
113
+ <tr>
114
+ <td><code class="language-css">respond-to(mobile-portrait-and-below)</code></td>
115
+ <td class="response-example respond-to-mobile-portrait-and-below"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
116
+ </tr>
117
+ <tr>
118
+ <td><code class="language-css">respond-to(mobile-landscape-and-below)</code></td>
119
+ <td class="response-example respond-to-mobile-landscape-and-below"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
120
+ </tr>
121
+ <tr>
122
+ <td><code class="language-css">respond-to(tablet-and-below)</code></td>
123
+ <td class="response-example respond-to-tablet-and-below"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
124
+ </tr>
125
+ <tr>
126
+ <td><code class="language-css">respond-to(tablet-portrait-and-below)</code></td>
127
+ <td class="response-example respond-to-tablet-portrait-and-below"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
128
+ </tr>
129
+ <tr>
130
+ <td><code class="language-css">respond-to(tablet-landscape-and-below)</code></td>
131
+ <td class="response-example respond-to-tablet-landscape-and-below"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
132
+ </tr>
133
+ <tr>
134
+ <td><code class="language-css">respond-to(desktop-and-below)</code></td>
135
+ <td class="response-example respond-to-desktop-and-below"><span class="isInactive">inactive</span> <span class="isResponding">responding</span></td>
136
+ </tr>
137
+ </tbody>
138
+ </table>
139
+ </div> <!-- /wrapper -->
140
+
141
+ </body>
@@ -0,0 +1,181 @@
1
+ // =============================================================================
2
+ // Respond-to Test Bed
3
+ //
4
+ // =============================================================================
5
+
6
+ @import "respond-to";
7
+
8
+ @include respond-to-breakpoints( mobile-portrait 320px,
9
+ mobile-landscape 480px,
10
+ tablet-portrait 600px,
11
+ tablet-landscape 768px,
12
+ desktop 992px);
13
+
14
+
15
+ $green: #a7e040;
16
+
17
+ body {
18
+ font: 16px/21px 'Helvetica Neue', Arial, sans-serif;
19
+ }
20
+
21
+ .wrapper {
22
+ margin: 0 auto;
23
+ padding: 0 1em;
24
+ max-width: 1000px;
25
+ }
26
+
27
+ // =============================================================================
28
+ // Respond-to Media Queries
29
+ // =============================================================================
30
+
31
+ @mixin is-responding {
32
+ // Make it green!
33
+ background: $green;
34
+ color: white;
35
+ // Show isResponding and hide is Inactive
36
+ .isResponding { display: inline; }
37
+ .isInactive { display: none; }
38
+ }
39
+
40
+ .mq-mixins-test {
41
+
42
+ width: 100%;
43
+
44
+ tbody {
45
+
46
+ .response-example {
47
+ text-align: center;
48
+ color: #ccc;
49
+ .isResponding { display: none; }
50
+ }
51
+
52
+ // Only
53
+ // =============================================================================
54
+
55
+ .respond-to-mobile {
56
+ @include respond-to(mobile-only) {
57
+ @include is-responding;
58
+ }
59
+ }
60
+ .respond-to-mobile-portrait {
61
+ @include respond-to(mobile-portrait-only) {
62
+ @include is-responding;
63
+ }
64
+ }
65
+ .respond-to-mobile-landscape {
66
+ @include respond-to(mobile-landscape-only) {
67
+ @include is-responding;
68
+ }
69
+ }
70
+
71
+ .respond-to-tablet {
72
+ @include respond-to(tablet-only) {
73
+ @include is-responding;
74
+ }
75
+ }
76
+
77
+ .respond-to-tablet-portrait {
78
+ @include respond-to(tablet-portrait-only) {
79
+ @include is-responding;
80
+ }
81
+ }
82
+
83
+ .respond-to-tablet-landscape {
84
+ @include respond-to(tablet-landscape-only) {
85
+ @include is-responding;
86
+ }
87
+ }
88
+
89
+ .respond-to-desktop {
90
+ @include respond-to(desktop-only) {
91
+ @include is-responding;
92
+ }
93
+ }
94
+
95
+ // And Up
96
+ // =============================================================================
97
+
98
+ .respond-to-mobile-and-up {
99
+ @include respond-to(mobile-and-up) {
100
+ @include is-responding;
101
+ }
102
+ }
103
+ .respond-to-mobile-portrait-and-up {
104
+ @include respond-to(mobile-portrait-and-up) {
105
+ @include is-responding;
106
+ }
107
+ }
108
+ .respond-to-mobile-landscape-and-up {
109
+ @include respond-to(mobile-landscape-and-up) {
110
+ @include is-responding;
111
+ }
112
+ }
113
+
114
+ .respond-to-tablet-and-up {
115
+ @include respond-to(tablet-and-up) {
116
+ @include is-responding;
117
+ }
118
+ }
119
+
120
+ .respond-to-tablet-portrait-and-up {
121
+ @include respond-to(tablet-portrait-and-up) {
122
+ @include is-responding;
123
+ }
124
+ }
125
+
126
+ .respond-to-tablet-landscape-and-up {
127
+ @include respond-to(tablet-landscape-and-up) {
128
+ @include is-responding;
129
+ }
130
+ }
131
+
132
+ .respond-to-desktop-and-up {
133
+ @include respond-to(desktop-and-up) {
134
+ @include is-responding;
135
+ }
136
+ }
137
+
138
+ // And Below
139
+ // =============================================================================
140
+
141
+ .respond-to-mobile-and-below {
142
+ @include respond-to(mobile-and-below) {
143
+ @include is-responding;
144
+ }
145
+ }
146
+ .respond-to-mobile-portrait-and-below {
147
+ @include respond-to(mobile-portrait-and-below) {
148
+ @include is-responding;
149
+ }
150
+ }
151
+ .respond-to-mobile-landscape-and-below {
152
+ @include respond-to(mobile-landscape-and-below) {
153
+ @include is-responding;
154
+ }
155
+ }
156
+
157
+ .respond-to-tablet-and-below {
158
+ @include respond-to(tablet-and-below) {
159
+ @include is-responding;
160
+ }
161
+ }
162
+
163
+ .respond-to-tablet-portrait-and-below {
164
+ @include respond-to(tablet-portrait-and-below) {
165
+ @include is-responding;
166
+ }
167
+ }
168
+
169
+ .respond-to-tablet-landscape-and-below {
170
+ @include respond-to(tablet-landscape-and-below) {
171
+ @include is-responding;
172
+ }
173
+ }
174
+
175
+ .respond-to-desktop-and-below {
176
+ @include respond-to(desktop-and-below) {
177
+ @include is-responding;
178
+ }
179
+ }
180
+ }
181
+ }
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: responder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha.1
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Daniel Guillan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sass
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: compass
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.12.2
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.12.2
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Magic media queries for your Compass project
63
+ email:
64
+ - daniel.guillan@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - lib/responder.rb
75
+ - lib/responder/version.rb
76
+ - responder.gemspec
77
+ - scss/functions.scss
78
+ - scss/respond-to.scss
79
+ - test/config.rb
80
+ - test/css/style.css
81
+ - test/index.html
82
+ - test/scss/style.scss
83
+ homepage: http://github.com/danielguillan/responder
84
+ licenses: []
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ segments:
96
+ - 0
97
+ hash: 4469443832490834780
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>'
102
+ - !ruby/object:Gem::Version
103
+ version: 1.3.1
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 1.8.24
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: Magic media queries for your Compass project
110
+ test_files:
111
+ - test/config.rb
112
+ - test/css/style.css
113
+ - test/index.html
114
+ - test/scss/style.scss