responder 0.0.1.alpha.2 → 0.0.1.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,10 +14,6 @@ In your project's config.rb file add:
14
14
 
15
15
  require "responder"
16
16
 
17
- Install the Compass extension:
18
-
19
- $ compass install responder
20
-
21
17
  Finally import responder into your sass code
22
18
 
23
19
  @import "responder";
@@ -103,5 +99,4 @@ min-width value is the first breakpoint of the group and max-width is the last o
103
99
 
104
100
  ## What's next?
105
101
 
106
- - Support for groups with more than 2 breakpoints
107
102
  - Support for more media features (height, device-dimensions, orientation, retina displays, …)
@@ -1,3 +1,3 @@
1
1
  module Responder
2
- VERSION = "0.0.1.alpha.2"
2
+ VERSION = "0.0.1.alpha.3"
3
3
  end
@@ -46,29 +46,42 @@
46
46
  // =============================================================================
47
47
 
48
48
  @function createBreakpointGroups($breakpoint-names, $breakpoint-values) {
49
+ $captured-groups: ();
50
+ $new-group: ();
49
51
  $groups: ();
50
- $total-groups: 0;
51
- $last: 0;
52
52
 
53
+ // Create a list with all the captured groups breakpoint names and indexes
53
54
  @for $i from 1 through length($breakpoint-names) {
54
55
  $group: regex(nth($breakpoint-names,$i), '([a-z]+)?\-');
55
- $repeated: false;
56
-
57
56
  @if $group != '' {
57
+ $group: join($group, $i, space);
58
+ $captured-groups: append($captured-groups, $group, comma);
59
+ }
60
+ }
58
61
 
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
- }
62
+ // Save a list of groups with min and max values
63
+ // eg: foo 100px 200px, bar 200px 300px;
64
+ @for $i from 1 through length($captured-groups) {
65
+
66
+ $current-group: nth($captured-groups, $i);
67
+ $current-group-name: nth($current-group,1);
68
+ $current-group-index: nth($current-group,2);
69
+
70
+ // Initial group
71
+ @if $i == 1 {
72
+ $new-group: $current-group-name;
73
+ $new-group: append($new-group, nth($breakpoint-values, $current-group-index), space);
74
+ // New and last groups
75
+ } @else if $current-group-name != nth($new-group, 1) or $i == length($captured-groups) {
76
+ // Find the previous breakpoint value (max-width for the group)
77
+ $previous-breakpoint-value: nth($breakpoint-values, ($current-group-index));
78
+ // The current group is ready
79
+ $new-group: append($new-group, $previous-breakpoint-value, space);
80
+ // Save the final group in the groups list
81
+ $groups: append($groups, $new-group, comma);
82
+ // Start a new group adding its name and min value
83
+ $new-group: $current-group-name;
84
+ $new-group: append($new-group, nth($breakpoint-values, $current-group-index), space);
72
85
  }
73
86
  }
74
87
 
data/test/css/style.css CHANGED
@@ -79,7 +79,7 @@ tr > td:first-child {
79
79
  display: none;
80
80
  }
81
81
  }
82
- @media (min-width: 600px) and (max-width: 992px) {
82
+ @media (min-width: 600px) and (max-width: 768px) {
83
83
  /* line 76, ../scss/style.scss */
84
84
  .mq-mixins-test tbody .respond-to-tablet {
85
85
  background: #a7e040;
@@ -289,7 +289,7 @@ tr > td:first-child {
289
289
  display: none;
290
290
  }
291
291
  }
292
- @media (max-width: 992px) {
292
+ @media (max-width: 768px) {
293
293
  /* line 162, ../scss/style.scss */
294
294
  .mq-mixins-test tbody .respond-to-tablet-and-below {
295
295
  background: #a7e040;
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: -1490146870
4
+ hash: 1025133085
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 1
10
10
  - alpha
11
- - 2
12
- version: 0.0.1.alpha.2
11
+ - 3
12
+ version: 0.0.1.alpha.3
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-02 00:00:00 Z
20
+ date: 2012-10-04 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: sass