responsive-modular-scale 0.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b9580e13763bfd9ef6dfb3d6614f68bd801e5e4e
4
+ data.tar.gz: 54191333e16cd744b26bb8a2479fbc7b83ee03d2
5
+ SHA512:
6
+ metadata.gz: e4d6b8ec261667e636fb9ff5f1180310bc7a6b515eaec4cf964a5dfa0758e681c89f5d95210c244424556c909d116816250b722f2e4ecabe82fa5566a57deab4
7
+ data.tar.gz: c06466c275cdd4744a2b679ebcf303d9ce40525afcc78675896cd3f3f9438d2551adefac8782e8953fbe3f7b1fc1bf04e342e70897ea4d8cfb3dcae1efdeca89
@@ -0,0 +1,10 @@
1
+ require 'compass'
2
+ require 'modular-scale'
3
+
4
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
5
+ Compass::Frameworks.register('responsive-modular-scale', :path => extension_path)
6
+
7
+ module ResponsiveModularScale
8
+ VERSION = "0.0.1.1"
9
+ DATE = "2013-12-28"
10
+ end
data/license.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Geoff Kimball
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,54 @@
1
+ # Responsive Modular Scale
2
+
3
+ ## Overview
4
+
5
+ This is a responsive extension of the Sass team's [modular-scale](https://github.com/Team-Sass/modular-scale) add-on. A modular typographic scale gives you a set of predefined values to use in your design, based on one or more base sizes and one or more intervals. You can learn more about modular scale typography on [A List Apart](http://www.alistapart.com/articles/more-meaningful-typography/), and quickly make a modular scale using [Tim Brown](http://twitter.com/nicewebtype)'s [modular scale tool](http://modularscale.com/).
6
+
7
+ Modular scales are great, but type has a tendency to get a little too big on smaller screens. What responsive-modular-scale allows you to do is quickly create multiple scales for different screen sizes. By changing the intervals used, but not the base sizes, we can compress the scale for smaller screens and expand it out for bigger screens. For example, a default scale could use a 1.333:1 ratio (a perfect fourth), and on screens 768px (everyone's favorite breakpoint) and up, the scale changes to use a 1.5:1 ratio (a perfect fifth) instead. Our base value stays the same, but the gaps between values in the scale widen, increasing the size of the type to a more appropriate size.
8
+
9
+ ## Installation
10
+
11
+ gem install responsive-modular-scale
12
+
13
+ Add `require 'responsive-modular-scale'` to your Compass project's config file.
14
+
15
+ Then import it into your stylesheet like so: `@import 'responsive-modular-scale';`
16
+
17
+ ## Usage
18
+
19
+ To create a scale we need one or more base values and one or more intervals. By default, the scale will use a 16px base value and two intervals: 1.333:1 (a fourth) by default, and 1.5:1 (a fifth) at 768px and above. You can change these values by calling `set-scales()` at the top of your stylesheet.
20
+
21
+ ```scss
22
+ // Change just the base values, not the intervals
23
+ @include set-scales(16px 100px);
24
+
25
+ // Use a fourth by default, and a fifth for larger screens
26
+ @include set-scales(16px, fourth(), 768px fifth());
27
+
28
+ // Use a fourth by default, an augmented fourth for medium screens, and a fifth for large screens
29
+ @include set-scales(16px, fourth(), 640px augmented-fourth(), 1024px fifth());
30
+ ```
31
+
32
+ Now we just have to call the modular scale function.
33
+
34
+ ```scss
35
+ h1 {
36
+ @include rms(6);
37
+ }
38
+ h2 {
39
+ @include rms(5);
40
+ }
41
+ p {
42
+ @include rms(0); // 0 is our base value
43
+ }
44
+ ```
45
+
46
+ ## Things to change
47
+
48
+ 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:
49
+
50
+ - Better support for multiple ratios: they'll only work if passed in as `1000px (fourth() fifth())`
51
+ - Switch to em-based font sizes and breakpoints
52
+ - Add the ability to correct an em value if the base font size has changed
53
+ - Allow the value of `$n` to be changed at breakpoints, to allow for finer control over font sizes
54
+ - Expample: `@include set-scales(16px, 1.5, 768px 2); h1 { @include rms(5, 6); }`
@@ -0,0 +1,3 @@
1
+ @import 'modular-scale';
2
+ @import 'responsive-modular-scale/helpers';
3
+ @import 'responsive-modular-scale/functions';
@@ -0,0 +1,65 @@
1
+ $rms-base: 16px;
2
+ $rms-intervals: (0px fourth()), (768px fifth());
3
+
4
+ /*
5
+ Sets user-defined values for the modular scale, which replace the default values defined above. The function accepts any number of arguments which should take the form:
6
+
7
+ $base, $interval1, $interval2, ...
8
+
9
+ @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.
10
+ @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).
11
+ */
12
+ @mixin set-scales($args...) {
13
+ // If no arguments were given
14
+ @if length($args) == 0 {
15
+ @warn 'No base values or intervals were set, so the default values will be used.';
16
+ }
17
+ // If at least one argument was given
18
+ @else {
19
+ // The first argument should be one or more pixel values
20
+ $rms-base: nth($args, 1);
21
+
22
+ // If more than one argument was given
23
+ @if length($args) > 1 {
24
+ // Remove the default breakpoints and intervals
25
+ $rms-intervals: ();
26
+
27
+ @for $i from 2 through length($args) {
28
+ // If a list item only has one value, assume it's an interval and set the breakpoint to 0px
29
+ @if length(nth($args, $i)) == 1 {
30
+ $rms-intervals: append($rms-intervals, 0px nth($args, $i));
31
+ }
32
+ // Otherwise copy the list as-is
33
+ @else {
34
+ $rms-intervals: append($rms-intervals, nth($args, $i));
35
+ }
36
+ }
37
+ }
38
+ // If only one argument was given
39
+ @else {
40
+ @warn 'No intervals were set, so the default values will be used.';
41
+ }
42
+ }
43
+ }
44
+
45
+ /*
46
+ Iterates through the list of breakpoints and intervals, outputting multiple font-size declarations for each breakpoint.
47
+
48
+ @param (number) $n: position on the modular scale to use.
49
+ */
50
+ @mixin rms($n: 0) {
51
+ @each $interval in $rms-intervals {
52
+ $scale-breakpoint: nth($interval, 1);
53
+ $scale-interval: nth($interval, 2);
54
+ $output: ms($n, $rms-base, $scale-interval);
55
+
56
+ @if $scale-breakpoint == 0px {
57
+ font-size: $output;
58
+ }
59
+ @else {
60
+ @media screen and (min-width: $scale-breakpoint) {
61
+ font-size: $output;
62
+ }
63
+ }
64
+ }
65
+ }
@@ -0,0 +1 @@
1
+ // emCalc will go here, and perhaps also a function to adjust an em value using a different base value.
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: responsive-modular-scale
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Geoff Kimball
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: modular-scale
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.6
27
+ description: Responsive enhancements for the Sass modular scale.
28
+ email: gakimball@bsu.edu
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/responsive-modular-scale.rb
34
+ - readme.md
35
+ - license.md
36
+ - stylesheets/_responsive-modular-scale.scss
37
+ - stylesheets/responsive-modular-scale/_functions.scss
38
+ - stylesheets/responsive-modular-scale/_helpers.scss
39
+ homepage: http://github.com/gakimball/responsive-modular-scale
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.0.14
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: Responsive enhancements for the Sass modular scale.
63
+ test_files: []