responder 0.0.1.alpha.6 → 0.0.1.alpha.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Magic media queries for your Compass project. You define the breakpoints, Responder takes care of the rest.
4
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.
5
+ Forget about variables and long lists of unmanageable and unreusable mixins. Responder is the only media queries mixin you'll ever need. And it's always ready to use.
6
6
 
7
7
  ## Installation
8
8
 
@@ -22,11 +22,11 @@ Finally import responder into your sass code
22
22
 
23
23
  ### 1. Define your own breakpoints
24
24
 
25
- Include the `respond-to-breakpoints()` mixin in your stylesheet and pass your list of custom breakpoints. Define as many as you need and give each one of them a name and a min-width value.
25
+ Include the `responder-breakpoints()` mixin in your stylesheet and pass your list of custom breakpoints. Define as many as you need and give each one of them a name and a min-width value in pixels.
26
26
 
27
27
  *An example:*
28
28
 
29
- @include respond-to-breakpoints( mobile-portrait 320px,
29
+ @include responder-breakpoints( mobile-portrait 320px,
30
30
  mobile-landscape 480px,
31
31
  tablet-portrait 600px,
32
32
  tablet-landscape 768px,
@@ -34,6 +34,19 @@ Include the `respond-to-breakpoints()` mixin in your stylesheet and pass your li
34
34
 
35
35
  **Important:** Start with the smallest breakpoint and grow your list from there up to the bigger one.
36
36
 
37
+ #### Ems by default
38
+
39
+ Responder will do the math for you and convert your breakpoint values into ems. By default Responder uses the Compass $base-font-size configurable variable as the context.
40
+
41
+ **Need to change the context?**
42
+
43
+ $responder-ems-context: $my-own-context;
44
+
45
+ **I Prefer pixel breakpoints!** Easy:
46
+
47
+ $responder-use-ems: false;
48
+
49
+
37
50
  ### 2. Using the respond-to mixin
38
51
 
39
52
  Yep, that was it. Your mixin is ready to use.
@@ -1,3 +1,3 @@
1
1
  module Responder
2
- VERSION = "0.0.1.alpha.6"
2
+ VERSION = "0.0.1.alpha.7"
3
3
  end
@@ -39,12 +39,11 @@
39
39
  }
40
40
 
41
41
  @if $breakpoint-extend == only {
42
- @media (min-width: $min-width) and (max-width: ($max-width - 1)) { @content; }
42
+ @media (min-width: getSize($min-width)) and (max-width: getSize($max-width - 1)) { @content; }
43
43
  } @else if $breakpoint-extend == and-up {
44
- @media (min-width: $min-width) { @content; }
44
+ @media (min-width: getSize($min-width)) { @content; }
45
45
  } @else if $breakpoint-extend == and-below {
46
- $max-width: $max-width - 1;
47
- @media (max-width: ($max-width - 1)) { @content; }
46
+ @media (max-width: getSize($max-width - 1)) { @content; }
48
47
  }
49
48
  }
50
49
  }
@@ -6,6 +6,7 @@
6
6
  // 2. Get breakpoint Values list
7
7
  // 3. Get breakpoint Groups list with min and max values
8
8
  // 4. Get the Respond-to breakpoint
9
+ // 4. Get size (px or em)
9
10
  //
10
11
  // =============================================================================
11
12
 
@@ -134,4 +135,17 @@
134
135
 
135
136
  @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]';
136
137
  @return 'error';
138
+ }
139
+
140
+ // =============================================================================
141
+ // 5. Get size
142
+ // Returns the breakpoint value in pixels or ems.
143
+ // =============================================================================
144
+
145
+ @function getSize($value, $context: $responder-ems-context) {
146
+ @if $responder-use-ems == true {
147
+ @return $value / $context +em;
148
+ } @else {
149
+ @return $value;
150
+ }
137
151
  }
data/scss/responder.scss CHANGED
@@ -1,8 +1,8 @@
1
1
  // =============================================================================
2
2
  // Responder
3
3
  //
4
- // Magic media queries for your Compass project. You define the breakpoints,
5
- // Respond-to takes care of the rest.
4
+ // Magic media queries for your Compass project. You define the breakpoints,
5
+ // Responder takes care of the rest.
6
6
  //
7
7
  // More info, installation and usage:
8
8
  // https://github.com/danielguillan/respond-to
@@ -13,6 +13,7 @@
13
13
  //
14
14
  // =============================================================================
15
15
 
16
+ @import 'compass';
16
17
  @import 'responder/respond-to';
17
18
  @import 'responder/functions';
18
19
 
@@ -24,11 +25,17 @@ $breakpoint-names: ();
24
25
  $breakpoint-values: ();
25
26
  $breakpoint-groups: ();
26
27
 
28
+ // Configurable variables
29
+ // =============================================================================
30
+
31
+ $responder-use-ems: true !default;
32
+ $responder-ems-context: $base-font-size !default;
33
+
27
34
  // =============================================================================
28
35
  // 2. Initialization
29
36
  // =============================================================================
30
37
 
31
- @mixin respond-to-breakpoints($breakpoints...) {
38
+ @mixin responder-breakpoints($breakpoints...) {
32
39
 
33
40
  @if length($breakpoints) > 1 {
34
41
  $breakpoint-names: getBreakpointNames($breakpoints);
data/test/css/style.css CHANGED
@@ -2,7 +2,7 @@
2
2
  body {
3
3
  font: 16px/21px "Helvetica Neue", Arial, sans-serif;
4
4
  }
5
- @media (min-width: 320px) and (max-width: 599px) {
5
+ @media (min-width: 20em) and (max-width: 37.4375em) {
6
6
  /* line 17, ../scss/style.scss */
7
7
  body {
8
8
  font-size: 95%;
@@ -34,7 +34,7 @@ tr > td:first-child {
34
34
  .mq-mixins-test tbody .response-example .isResponding {
35
35
  display: none;
36
36
  }
37
- @media (min-width: 320px) and (max-width: 599px) {
37
+ @media (min-width: 20em) and (max-width: 37.4375em) {
38
38
  /* line 60, ../scss/style.scss */
39
39
  .mq-mixins-test tbody .respond-to-mobile {
40
40
  background: #a7e040;
@@ -49,7 +49,7 @@ tr > td:first-child {
49
49
  display: none;
50
50
  }
51
51
  }
52
- @media (min-width: 320px) and (max-width: 479px) {
52
+ @media (min-width: 20em) and (max-width: 29.9375em) {
53
53
  /* line 65, ../scss/style.scss */
54
54
  .mq-mixins-test tbody .respond-to-mobile-portrait {
55
55
  background: #a7e040;
@@ -64,7 +64,7 @@ tr > td:first-child {
64
64
  display: none;
65
65
  }
66
66
  }
67
- @media (min-width: 480px) and (max-width: 599px) {
67
+ @media (min-width: 30em) and (max-width: 37.4375em) {
68
68
  /* line 70, ../scss/style.scss */
69
69
  .mq-mixins-test tbody .respond-to-mobile-landscape {
70
70
  background: #a7e040;
@@ -79,7 +79,7 @@ tr > td:first-child {
79
79
  display: none;
80
80
  }
81
81
  }
82
- @media (min-width: 600px) and (max-width: 991px) {
82
+ @media (min-width: 37.5em) and (max-width: 61.9375em) {
83
83
  /* line 76, ../scss/style.scss */
84
84
  .mq-mixins-test tbody .respond-to-tablet {
85
85
  background: #a7e040;
@@ -94,7 +94,7 @@ tr > td:first-child {
94
94
  display: none;
95
95
  }
96
96
  }
97
- @media (min-width: 600px) and (max-width: 767px) {
97
+ @media (min-width: 37.5em) and (max-width: 47.9375em) {
98
98
  /* line 82, ../scss/style.scss */
99
99
  .mq-mixins-test tbody .respond-to-tablet-portrait {
100
100
  background: #a7e040;
@@ -109,7 +109,7 @@ tr > td:first-child {
109
109
  display: none;
110
110
  }
111
111
  }
112
- @media (min-width: 768px) and (max-width: 991px) {
112
+ @media (min-width: 48em) and (max-width: 61.9375em) {
113
113
  /* line 88, ../scss/style.scss */
114
114
  .mq-mixins-test tbody .respond-to-tablet-landscape {
115
115
  background: #a7e040;
@@ -124,7 +124,7 @@ tr > td:first-child {
124
124
  display: none;
125
125
  }
126
126
  }
127
- @media (min-width: 992px) {
127
+ @media (min-width: 62em) {
128
128
  /* line 94, ../scss/style.scss */
129
129
  .mq-mixins-test tbody .respond-to-desktop {
130
130
  background: #a7e040;
@@ -139,7 +139,7 @@ tr > td:first-child {
139
139
  display: none;
140
140
  }
141
141
  }
142
- @media (min-width: 320px) {
142
+ @media (min-width: 20em) {
143
143
  /* line 103, ../scss/style.scss */
144
144
  .mq-mixins-test tbody .respond-to-mobile-and-up {
145
145
  background: #a7e040;
@@ -154,7 +154,7 @@ tr > td:first-child {
154
154
  display: none;
155
155
  }
156
156
  }
157
- @media (min-width: 320px) {
157
+ @media (min-width: 20em) {
158
158
  /* line 108, ../scss/style.scss */
159
159
  .mq-mixins-test tbody .respond-to-mobile-portrait-and-up {
160
160
  background: #a7e040;
@@ -169,7 +169,7 @@ tr > td:first-child {
169
169
  display: none;
170
170
  }
171
171
  }
172
- @media (min-width: 480px) {
172
+ @media (min-width: 30em) {
173
173
  /* line 113, ../scss/style.scss */
174
174
  .mq-mixins-test tbody .respond-to-mobile-landscape-and-up {
175
175
  background: #a7e040;
@@ -184,7 +184,7 @@ tr > td:first-child {
184
184
  display: none;
185
185
  }
186
186
  }
187
- @media (min-width: 600px) {
187
+ @media (min-width: 37.5em) {
188
188
  /* line 119, ../scss/style.scss */
189
189
  .mq-mixins-test tbody .respond-to-tablet-and-up {
190
190
  background: #a7e040;
@@ -199,7 +199,7 @@ tr > td:first-child {
199
199
  display: none;
200
200
  }
201
201
  }
202
- @media (min-width: 600px) {
202
+ @media (min-width: 37.5em) {
203
203
  /* line 125, ../scss/style.scss */
204
204
  .mq-mixins-test tbody .respond-to-tablet-portrait-and-up {
205
205
  background: #a7e040;
@@ -214,7 +214,7 @@ tr > td:first-child {
214
214
  display: none;
215
215
  }
216
216
  }
217
- @media (min-width: 768px) {
217
+ @media (min-width: 48em) {
218
218
  /* line 131, ../scss/style.scss */
219
219
  .mq-mixins-test tbody .respond-to-tablet-landscape-and-up {
220
220
  background: #a7e040;
@@ -229,7 +229,7 @@ tr > td:first-child {
229
229
  display: none;
230
230
  }
231
231
  }
232
- @media (min-width: 992px) {
232
+ @media (min-width: 62em) {
233
233
  /* line 137, ../scss/style.scss */
234
234
  .mq-mixins-test tbody .respond-to-desktop-and-up {
235
235
  background: #a7e040;
@@ -244,7 +244,7 @@ tr > td:first-child {
244
244
  display: none;
245
245
  }
246
246
  }
247
- @media (max-width: 598px) {
247
+ @media (max-width: 37.4375em) {
248
248
  /* line 146, ../scss/style.scss */
249
249
  .mq-mixins-test tbody .respond-to-mobile-and-below {
250
250
  background: #a7e040;
@@ -259,7 +259,7 @@ tr > td:first-child {
259
259
  display: none;
260
260
  }
261
261
  }
262
- @media (max-width: 478px) {
262
+ @media (max-width: 29.9375em) {
263
263
  /* line 151, ../scss/style.scss */
264
264
  .mq-mixins-test tbody .respond-to-mobile-portrait-and-below {
265
265
  background: #a7e040;
@@ -274,7 +274,7 @@ tr > td:first-child {
274
274
  display: none;
275
275
  }
276
276
  }
277
- @media (max-width: 598px) {
277
+ @media (max-width: 37.4375em) {
278
278
  /* line 156, ../scss/style.scss */
279
279
  .mq-mixins-test tbody .respond-to-mobile-landscape-and-below {
280
280
  background: #a7e040;
@@ -289,7 +289,7 @@ tr > td:first-child {
289
289
  display: none;
290
290
  }
291
291
  }
292
- @media (max-width: 990px) {
292
+ @media (max-width: 61.9375em) {
293
293
  /* line 162, ../scss/style.scss */
294
294
  .mq-mixins-test tbody .respond-to-tablet-and-below {
295
295
  background: #a7e040;
@@ -304,7 +304,7 @@ tr > td:first-child {
304
304
  display: none;
305
305
  }
306
306
  }
307
- @media (max-width: 766px) {
307
+ @media (max-width: 47.9375em) {
308
308
  /* line 168, ../scss/style.scss */
309
309
  .mq-mixins-test tbody .respond-to-tablet-portrait-and-below {
310
310
  background: #a7e040;
@@ -319,7 +319,7 @@ tr > td:first-child {
319
319
  display: none;
320
320
  }
321
321
  }
322
- @media (max-width: 990px) {
322
+ @media (max-width: 61.9375em) {
323
323
  /* line 174, ../scss/style.scss */
324
324
  .mq-mixins-test tbody .respond-to-tablet-landscape-and-below {
325
325
  background: #a7e040;
@@ -334,7 +334,7 @@ tr > td:first-child {
334
334
  display: none;
335
335
  }
336
336
  }
337
- @media (max-width: 990px) {
337
+ @media (max-width: 61.9375em) {
338
338
  /* line 180, ../scss/style.scss */
339
339
  .mq-mixins-test tbody .respond-to-desktop-and-below {
340
340
  background: #a7e040;
data/test/scss/style.scss CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  @import "responder";
7
7
 
8
- @include respond-to-breakpoints( mobile-portrait 320px,
8
+ @include responder-breakpoints( mobile-portrait 320px,
9
9
  mobile-landscape 480px,
10
10
  tablet-portrait 600px,
11
11
  tablet-landscape 768px,
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: responder
3
3
  version: !ruby/object:Gem::Version
4
- hash: -3476678256
4
+ hash: -2869641776
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 1
10
10
  - alpha
11
- - 6
12
- version: 0.0.1.alpha.6
11
+ - 7
12
+ version: 0.0.1.alpha.7
13
13
  platform: ruby
14
14
  authors:
15
15
  - Daniel Guillan
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-10-08 00:00:00 Z
20
+ date: 2012-10-10 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: sass