breakpoint 1.2 → 1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.markdown +4 -0
- data/README.markdown +2 -3
- data/lib/breakpoint.rb +16 -10
- data/stylesheets/_breakpoint.scss +26 -24
- data/stylesheets/breakpoint/_helpers.scss +23 -3
- metadata +3 -3
data/CHANGELOG.markdown
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.3 - August 28th, 2012
|
4
|
+
* better conversion to base-ems
|
5
|
+
* fix floating point error
|
6
|
+
|
3
7
|
## 1.2 - August 16th, 2012
|
4
8
|
* Added ability to force the 'all' media type to be written by setting `$breakpoint-force-media-all: true;`. Defaults to `false`.
|
5
9
|
* Added ability to generate no query fallback code. See the README for full documentaiton.
|
data/README.markdown
CHANGED
@@ -431,7 +431,6 @@ $breakpoint-no-query-wrappers: true;
|
|
431
431
|
```css
|
432
432
|
/* no-mq.css */
|
433
433
|
.no-mq #foo {
|
434
|
-
background: red;
|
435
434
|
background: green;
|
436
435
|
}
|
437
436
|
```
|
@@ -440,8 +439,8 @@ $breakpoint-no-query-wrappers: true;
|
|
440
439
|
|
441
440
|
Licensed under MIT/GPL.
|
442
441
|
|
443
|
-
|
444
|
-
http://www.gnu.org/licenses/gpl.html
|
442
|
+
GPL2 license:
|
443
|
+
http://www.gnu.org/licenses/gpl-2.0.html
|
445
444
|
|
446
445
|
MIT license:
|
447
446
|
http://www.opensource.org/licenses/mit-license.php
|
data/lib/breakpoint.rb
CHANGED
@@ -3,8 +3,8 @@ require 'compass'
|
|
3
3
|
Compass::Frameworks.register("breakpoint", :path => "#{File.dirname(__FILE__)}/..")
|
4
4
|
|
5
5
|
module Breakpoint
|
6
|
-
VERSION = "1.
|
7
|
-
DATE = "2012-08-
|
6
|
+
VERSION = "1.3"
|
7
|
+
DATE = "2012-08-28"
|
8
8
|
end
|
9
9
|
|
10
10
|
module Sass::Script::Functions
|
@@ -16,19 +16,25 @@ module Sass::Script::Functions
|
|
16
16
|
testList = Array.new
|
17
17
|
listLength = list.to_a.length - 1
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
# Only check if length greater than zero
|
20
|
+
# Was throwing errors for floats (but strangely, not for ints)
|
21
|
+
if listLength > 0
|
22
|
+
for i in 0..listLength
|
23
|
+
if list.value[i].class == Sass::Script::List
|
24
|
+
subList = list.value[i].to_a.length - 1
|
22
25
|
|
23
|
-
|
24
|
-
|
26
|
+
for j in 0..subList
|
27
|
+
testList << list.value[i].value[j]
|
28
|
+
end
|
29
|
+
else
|
30
|
+
testList << list.value[i]
|
25
31
|
end
|
26
|
-
else
|
27
|
-
testList << list.value[i]
|
28
32
|
end
|
33
|
+
result = testList.include?(feature)
|
34
|
+
else
|
35
|
+
result = false
|
29
36
|
end
|
30
37
|
|
31
|
-
result = testList.include?(feature)
|
32
38
|
Sass::Script::Bool.new(result)
|
33
39
|
end
|
34
40
|
end
|
@@ -12,6 +12,8 @@ $breakpoint-prefixed-queries: 'device-pixel-ratio' 'min-device-pixel-ratio' 'max
|
|
12
12
|
$breakpoint-no-queries: false !default;
|
13
13
|
$breakpoint-no-query-wrappers: false !default;
|
14
14
|
|
15
|
+
$breakpoint-base-font-size: false;
|
16
|
+
|
15
17
|
//////////////////////////////
|
16
18
|
// Import Breakpoint Helpers
|
17
19
|
//////////////////////////////
|
@@ -21,7 +23,7 @@ $breakpoint-no-query-wrappers: false !default;
|
|
21
23
|
//////////////////////////////
|
22
24
|
// Breakpoint Mixin
|
23
25
|
//////////////////////////////
|
24
|
-
@mixin breakpoint($breakpoint, $media: $breakpoint-default-media, $no-query: false) {
|
26
|
+
@mixin breakpoint($breakpoint, $media: $breakpoint-default-media, $no-query: false, $base-font-size: $breakpoint-base-font-size) {
|
25
27
|
// Query and Media String Defaults
|
26
28
|
$query: false !default;
|
27
29
|
$query-holder: false !default;
|
@@ -64,24 +66,24 @@ $breakpoint-no-query-wrappers: false !default;
|
|
64
66
|
@if $do-prefix {
|
65
67
|
@each $prfx in $breakpoint-prefixes {
|
66
68
|
@if $prfx == 'webkit' {
|
67
|
-
$webkit: breakpoint-switch($breakpoint, $media-string, true, $prfx);
|
69
|
+
$webkit: breakpoint-switch($breakpoint, $media-string, true, $prfx, $base-font-size: $base-font-size);
|
68
70
|
}
|
69
71
|
|
70
72
|
@if $prfx == 'moz' {
|
71
|
-
$moz: breakpoint-switch($breakpoint, $media-string, true, $prfx);
|
73
|
+
$moz: breakpoint-switch($breakpoint, $media-string, true, $prfx, $base-font-size: $base-font-size);
|
72
74
|
}
|
73
75
|
|
74
76
|
@if $prfx == 'o' {
|
75
|
-
$o: breakpoint-switch($breakpoint, $media-string, true, $prfx);
|
77
|
+
$o: breakpoint-switch($breakpoint, $media-string, true, $prfx, $base-font-size: $base-font-size);
|
76
78
|
}
|
77
79
|
|
78
80
|
@if $prfx == 'ms' {
|
79
|
-
$ms: breakpoint-switch($breakpoint, $media-string, true, $prfx);
|
81
|
+
$ms: breakpoint-switch($breakpoint, $media-string, true, $prfx, $base-font-size: $base-font-size);
|
80
82
|
}
|
81
83
|
}
|
82
84
|
}
|
83
85
|
@else {
|
84
|
-
$query: breakpoint-switch($breakpoint, $media-string, true);
|
86
|
+
$query: breakpoint-switch($breakpoint, $media-string, true, $base-font-size: $base-font-size);
|
85
87
|
}
|
86
88
|
}
|
87
89
|
@else {
|
@@ -97,41 +99,41 @@ $breakpoint-no-query-wrappers: false !default;
|
|
97
99
|
@each $bkpt in $breakpoint {
|
98
100
|
@if $prfx == 'webkit' {
|
99
101
|
@if $webkit-first {
|
100
|
-
$webkit: breakpoint-switch($bkpt, $media-string, true, $prfx);
|
102
|
+
$webkit: breakpoint-switch($bkpt, $media-string, true, $prfx, $base-font-size: $base-font-size);
|
101
103
|
$webkit-first: false;
|
102
104
|
}
|
103
105
|
@else {
|
104
|
-
$webkit: join($webkit, breakpoint-switch($bkpt, $media-string, $prefix: $prfx));
|
106
|
+
$webkit: join($webkit, breakpoint-switch($bkpt, $media-string, $prefix: $prfx, $base-font-size: $base-font-size));
|
105
107
|
}
|
106
108
|
}
|
107
109
|
|
108
110
|
@if $prfx == 'moz' {
|
109
111
|
@if $moz-first {
|
110
|
-
$moz: breakpoint-switch($bkpt, $media-string, true, $prfx);
|
112
|
+
$moz: breakpoint-switch($bkpt, $media-string, true, $prfx, $base-font-size: $base-font-size);
|
111
113
|
$moz-first: false;
|
112
114
|
}
|
113
115
|
@else {
|
114
|
-
$moz: join($moz, breakpoint-switch($bkpt, $media-string, $prefix: $prfx));
|
116
|
+
$moz: join($moz, breakpoint-switch($bkpt, $media-string, $prefix: $prfx, $base-font-size: $base-font-size));
|
115
117
|
}
|
116
118
|
}
|
117
119
|
|
118
120
|
@if $prfx == 'o' {
|
119
121
|
@if $o-first {
|
120
|
-
$o: breakpoint-switch($bkpt, $media-string, true, $prfx);
|
122
|
+
$o: breakpoint-switch($bkpt, $media-string, true, $prfx, $base-font-size: $base-font-size);
|
121
123
|
$o-first: false;
|
122
124
|
}
|
123
125
|
@else {
|
124
|
-
$o: join($o, breakpoint-switch($bkpt, $media-string, $prefix: $prfx));
|
126
|
+
$o: join($o, breakpoint-switch($bkpt, $media-string, $prefix: $prfx, $base-font-size: $base-font-size));
|
125
127
|
}
|
126
128
|
}
|
127
129
|
|
128
130
|
@if $prfx == 'ms' {
|
129
131
|
@if $ms-first {
|
130
|
-
$ms: breakpoint-switch($bkpt, $media-string, true, $prfx);
|
132
|
+
$ms: breakpoint-switch($bkpt, $media-string, true, $prfx, $base-font-size: $base-font-size);
|
131
133
|
$ms-first: false;
|
132
134
|
}
|
133
135
|
@else {
|
134
|
-
$ms: join($ms, breakpoint-switch($bkpt, $media-string, $prefix: $prfx));
|
136
|
+
$ms: join($ms, breakpoint-switch($bkpt, $media-string, $prefix: $prfx, $base-font-size: $base-font-size));
|
135
137
|
}
|
136
138
|
}
|
137
139
|
}
|
@@ -140,11 +142,11 @@ $breakpoint-no-query-wrappers: false !default;
|
|
140
142
|
@else {
|
141
143
|
@each $bkpt in $breakpoint {
|
142
144
|
@if $first == true {
|
143
|
-
$query: breakpoint-switch($bkpt, $media-string, true);
|
145
|
+
$query: breakpoint-switch($bkpt, $media-string, true, $base-font-size: $base-font-size);
|
144
146
|
$first: false;
|
145
147
|
}
|
146
148
|
@else {
|
147
|
-
$query: join($query, breakpoint-switch($bkpt, $media-string));
|
149
|
+
$query: join($query, breakpoint-switch($bkpt, $media-string, $base-font-size: $base-font-size));
|
148
150
|
}
|
149
151
|
}
|
150
152
|
}
|
@@ -194,7 +196,7 @@ $breakpoint-no-query-wrappers: false !default;
|
|
194
196
|
@include TXkgcmVzZXQhIEdvIGF3YXkh;
|
195
197
|
}
|
196
198
|
|
197
|
-
@function breakpoint-switch($breakpoint, $media-string, $first: false, $prefix: false) {
|
199
|
+
@function breakpoint-switch($breakpoint, $media-string, $first: false, $prefix: false, $base-font-size: $breakpoint-base-font-size) {
|
198
200
|
// Feature/Value/Length/Query Placehoders:
|
199
201
|
$feature: false !default;
|
200
202
|
$min-feature: "min-#{$breakpoint-default-pair}" !default;
|
@@ -215,7 +217,7 @@ $breakpoint-no-query-wrappers: false !default;
|
|
215
217
|
|
216
218
|
// If EM Breakpoints are active, do it!
|
217
219
|
@if $breakpoint-to-ems and type-of($value) == 'number' {
|
218
|
-
$value: breakpoint-to-base-em($value);
|
220
|
+
$value: breakpoint-to-base-em($value, $base-font-size);
|
219
221
|
}
|
220
222
|
// Build the Query
|
221
223
|
$query: breakpoint-generate($media-string, $feature, $value, $first);
|
@@ -237,10 +239,10 @@ $breakpoint-no-query-wrappers: false !default;
|
|
237
239
|
|
238
240
|
// If EM Breakpoints are active, do it!
|
239
241
|
@if $breakpoint-to-ems and type-of($min-value) == 'number' {
|
240
|
-
$min-value: breakpoint-to-base-em($min-value);
|
242
|
+
$min-value: breakpoint-to-base-em($min-value, $base-font-size);
|
241
243
|
}
|
242
244
|
@if $breakpoint-to-ems and type-of($max-value) == 'number' {
|
243
|
-
$max-value: breakpoint-to-base-em($max-value);
|
245
|
+
$max-value: breakpoint-to-base-em($max-value, $base-font-size);
|
244
246
|
}
|
245
247
|
|
246
248
|
// Min/Max for given
|
@@ -262,7 +264,7 @@ $breakpoint-no-query-wrappers: false !default;
|
|
262
264
|
|
263
265
|
// If EM Breakpoints are active, do it!
|
264
266
|
@if $breakpoint-to-ems and type-of($value) == 'number' {
|
265
|
-
$value: breakpoint-to-base-em($value);
|
267
|
+
$value: breakpoint-to-base-em($value, $base-font-size);
|
266
268
|
}
|
267
269
|
|
268
270
|
// Build the Query
|
@@ -297,7 +299,7 @@ $breakpoint-no-query-wrappers: false !default;
|
|
297
299
|
|
298
300
|
// If EM Breakpoints are active, do it!
|
299
301
|
@if $breakpoint-to-ems and type-of($value) == 'number' {
|
300
|
-
$value: breakpoint-to-base-em($value);
|
302
|
+
$value: breakpoint-to-base-em($value, $base-font-size);
|
301
303
|
}
|
302
304
|
|
303
305
|
// Build the Query
|
@@ -334,10 +336,10 @@ $breakpoint-no-query-wrappers: false !default;
|
|
334
336
|
|
335
337
|
// If EM Breakpoints are active, do it!
|
336
338
|
@if $breakpoint-to-ems and type-of($min-value) == 'number' {
|
337
|
-
$min-value: breakpoint-to-base-em($min-value);
|
339
|
+
$min-value: breakpoint-to-base-em($min-value, $base-font-size);
|
338
340
|
}
|
339
341
|
@if $breakpoint-to-ems and type-of($max-value) == 'number' {
|
340
|
-
$max-value: breakpoint-to-base-em($max-value);
|
342
|
+
$max-value: breakpoint-to-base-em($max-value, $base-font-size);
|
341
343
|
}
|
342
344
|
|
343
345
|
@if breakpoint-min-max($feature) == true {
|
@@ -1,9 +1,29 @@
|
|
1
1
|
//////////////////////////////
|
2
2
|
// Converts the input value to Base EMs
|
3
3
|
//////////////////////////////
|
4
|
-
@function breakpoint-to-base-em($value) {
|
4
|
+
@function breakpoint-to-base-em($value, $base-font-size: false) {
|
5
|
+
$value-unit: unit($value);
|
6
|
+
|
7
|
+
// Will convert relative EMs into root EMs.
|
8
|
+
@if $base-font-size and type-of($base-font-size) == 'number' and $value-unit == 'em' {
|
9
|
+
$base-unit: unit($base-font-size);
|
10
|
+
|
11
|
+
@if $base-unit == 'px' or $base-unit == '%' or $base-unit == 'em' or $base-unit == 'pt' {
|
12
|
+
@return base-conversion($value) / base-conversion($base-font-size) * 1em;
|
13
|
+
}
|
14
|
+
@else {
|
15
|
+
@warn '#{$base-font-size} is not set in valid units for font size!';
|
16
|
+
@return false;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
@else {
|
20
|
+
@return base-conversion($value);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
@function base-conversion($value) {
|
5
25
|
$unit: unit($value);
|
6
|
-
|
26
|
+
|
7
27
|
@if $unit == 'px' {
|
8
28
|
@return $value / 16px * 1em;
|
9
29
|
}
|
@@ -77,4 +97,4 @@
|
|
77
97
|
@else {
|
78
98
|
@return '-#{$prefix}-#{$property}';
|
79
99
|
}
|
80
|
-
}
|
100
|
+
}
|
metadata
CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
version: "1.
|
7
|
+
- 3
|
8
|
+
version: "1.3"
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Mason Wendell
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-08-
|
17
|
+
date: 2012-08-28 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|