responsive-modular-scale 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/responsive-modular-scale.rb +2 -2
- data/readme.md +15 -8
- data/stylesheets/responsive-modular-scale/_functions.scss +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01c90af923e443e030a50692a1944b36b95626c2
|
4
|
+
data.tar.gz: 78afd851a3140b6762690f2b16ee0a2bb7ffb09d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1c38a4fb039ebc13e2b978fcf692f7eaf1477857130d5b4ac54f5e39daeceb2c9d39b80b69bae16325cdd7c10da83863864c8d960930dfc29c11b31f136c8b1
|
7
|
+
data.tar.gz: 496aa18d5fd08bb0c3836b24d48419a3da7f8144096fc8211785c621fef4cf763620751475eb7ff3efdabd09e5addba305453d0d60abf33d4886a6311622ff2d
|
@@ -5,6 +5,6 @@ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
|
5
5
|
Compass::Frameworks.register('responsive-modular-scale', :path => extension_path)
|
6
6
|
|
7
7
|
module ResponsiveModularScale
|
8
|
-
VERSION = "0.
|
9
|
-
DATE = "2014-
|
8
|
+
VERSION = "0.2.0"
|
9
|
+
DATE = "2014-02-13"
|
10
10
|
end
|
data/readme.md
CHANGED
@@ -22,20 +22,21 @@ To create a set of scales we need one or more base values and one or more interv
|
|
22
22
|
|
23
23
|
```scss
|
24
24
|
// Change just the base values, keep the default scales
|
25
|
-
@include set-scales(16px 100px);
|
25
|
+
@include rms-set-scales(16px 100px);
|
26
26
|
|
27
27
|
// Use a fourth by default, and a fifth for larger screens
|
28
|
-
@include set-scales(16px, fourth
|
28
|
+
@include rms-set-scales(16px, $fourth, 768px $fifth;
|
29
29
|
|
30
30
|
// Use a fourth by default, an augmented fourth for medium screens, and a fifth for large screens
|
31
|
-
@include set-scales(16px, fourth
|
31
|
+
@include rms-set-scales(16px, $fourth, 640px $augmented-fourth, 1024px $fifth);
|
32
32
|
```
|
33
33
|
|
34
34
|
The base values should always be pixel values, but the breakpoints can be pixel- or em-based. By default, responsive-modular-scale will output all breakpoints and font-size values as em values, but you can change to pixels if you'd like.
|
35
35
|
|
36
36
|
```scss
|
37
37
|
// You can call this before or after set-scales()
|
38
|
-
@include use-pixels;
|
38
|
+
@include rms-use-pixels;
|
39
|
+
```
|
39
40
|
|
40
41
|
### Using the scales
|
41
42
|
|
@@ -60,7 +61,7 @@ Each call to `rms()` will generate one font-size declaration for each breakpoint
|
|
60
61
|
If you're outputting em-based values (the default) and want to adjust your base font size from the usual 16px, you'll need to let responsive-modular-scale know.
|
61
62
|
|
62
63
|
```scss
|
63
|
-
@include set-base(18px);
|
64
|
+
@include rms-set-base(18px);
|
64
65
|
```
|
65
66
|
|
66
67
|
This mixin doesn't output any CSS, it just changes the way ems are calculated internally.
|
@@ -68,7 +69,7 @@ This mixin doesn't output any CSS, it just changes the way ems are calculated in
|
|
68
69
|
If `rms()` is called on a container element, calls made on elements inside that container will not be the right size, due to the compounding nature of ems.
|
69
70
|
|
70
71
|
```scss
|
71
|
-
@include set-scales(16px, third
|
72
|
+
@include rms-set-scales(16px, $third, 768px $fourth);
|
72
73
|
|
73
74
|
.container {
|
74
75
|
@include rms(1); // 20px, or 1.25em
|
@@ -77,6 +78,7 @@ If `rms()` is called on a container element, calls made on elements inside that
|
|
77
78
|
@include rms(1); // 1.25em * 1.25em = 1.56em, or 25px
|
78
79
|
}
|
79
80
|
}
|
81
|
+
```
|
80
82
|
|
81
83
|
To correct this behavior, `rms()` includes an optional second parameter which will adjust the base font size used in em calculation. The value of the second parameter is the position on the modular scale that should be used as a base.
|
82
84
|
|
@@ -86,10 +88,11 @@ To correct this behavior, `rms()` includes an optional second parameter which wi
|
|
86
88
|
|
87
89
|
.child {
|
88
90
|
// By passing in a different base the resulting em value will be adjusted down
|
89
|
-
// The font sizes for .container and .child will visually
|
91
|
+
// The font sizes for .container and .child will visually appear the same, despite having different em values
|
90
92
|
@include rms(1, 1);
|
91
93
|
}
|
92
94
|
}
|
95
|
+
```
|
93
96
|
|
94
97
|
Currently the mixin will only correct one level deep.
|
95
98
|
|
@@ -97,7 +100,11 @@ Currently the mixin will only correct one level deep.
|
|
97
100
|
|
98
101
|
I'm no typography expert, so if you have any suggestions or comments, let me know! In the mean time here are things that need to be added or fixed:
|
99
102
|
|
100
|
-
- Better support for multiple ratios in a single scale: they'll only work if passed in as `1000px (fourth
|
103
|
+
- Better support for multiple ratios in a single scale: they'll only work if passed in as `1000px ($fourth $fifth)`
|
101
104
|
- Allow the value of `$n` to be changed at breakpoints, to allow for finer control over font sizes
|
102
105
|
- Expample: `@include set-scales(16px, 1.5, 768px 2); h1 { @include rms(5, 6); }`
|
103
106
|
- Ability to correct em values at more than one level deep
|
107
|
+
|
108
|
+
## Who made it
|
109
|
+
|
110
|
+
This whole shebang was put together by [Geoff Kimball](http://geoffkimball.com), but most of the heavy lifting is done by the Sass team's excellent [modular-scale](https://github.com/Team-Sass/modular-scale) library.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$rms-base: 16px;
|
2
|
-
$rms-intervals: (0px fourth
|
2
|
+
$rms-intervals: (0px $fourth), (768px $fifth);
|
3
3
|
$rms-usepixels: false;
|
4
4
|
|
5
5
|
/*
|
@@ -10,7 +10,7 @@ $rms-usepixels: false;
|
|
10
10
|
@param (number or list) $base: one or more pixel values to use as the base of the modular scale. These don't change between breakpoints.
|
11
11
|
@param (list) $interval: A list containing a pixel value (representing a min-width breakpoint) followed by an interval (an integer or one of modular-scale's predefined ratios).
|
12
12
|
*/
|
13
|
-
@mixin set-scales($args...) {
|
13
|
+
@mixin rms-set-scales($args...) {
|
14
14
|
// If no arguments were given
|
15
15
|
@if length($args) == 0 {
|
16
16
|
@warn 'No base values or intervals were set, so the default values will be used.';
|
@@ -49,7 +49,7 @@ $rms-usepixels: false;
|
|
49
49
|
@param (number) $start: index on the scale to start at (0 is the base value).
|
50
50
|
@param (number) $end: index on the scale to end at.
|
51
51
|
*/
|
52
|
-
@mixin list-scales($start: 0, $end: 20) {
|
52
|
+
@mixin rms-list-scales($start: 0, $end: 20) {
|
53
53
|
@each $scale in $rms-intervals {
|
54
54
|
$scale-breakpoint: nth($scale, 1);
|
55
55
|
$scale-interval: nth($scale, 2);
|
@@ -61,7 +61,7 @@ $rms-usepixels: false;
|
|
61
61
|
@debug 'Min-width: #{$scale-breakpoint} --';
|
62
62
|
}
|
63
63
|
|
64
|
-
@
|
64
|
+
@debug ms-list($start, $end, $rms-base, $scale-interval);
|
65
65
|
}
|
66
66
|
}
|
67
67
|
|
@@ -70,7 +70,7 @@ $rms-usepixels: false;
|
|
70
70
|
|
71
71
|
@param (boolean) $true: if true, the system will use pixels; otherwise, ems.
|
72
72
|
*/
|
73
|
-
@mixin use-pixels($true: true) {
|
73
|
+
@mixin rms-use-pixels($true: true) {
|
74
74
|
$rms-usepixels: $true;
|
75
75
|
}
|
76
76
|
|
@@ -79,7 +79,7 @@ $rms-usepixels: false;
|
|
79
79
|
|
80
80
|
@param (number) $number: pixel value to change to.
|
81
81
|
*/
|
82
|
-
@mixin set-base($number) {
|
82
|
+
@mixin rms-set-base($number) {
|
83
83
|
$rms-basefont: $number;
|
84
84
|
}
|
85
85
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: responsive-modular-scale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Kimball
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: modular-scale
|