shevy 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c1403531d39fd4e06573670a1e2170aa4dd38b9b
4
+ data.tar.gz: 74ab9b7eb3cecad08c93ac294e5351c4d3337021
5
+ SHA512:
6
+ metadata.gz: 4cede17f06f3c6aca56697caec4164c3f27a1af7e714aa240e377c1b258aa42d40fb843a17c060f3e62aa99489cfa7c3b45f754daba052aac34e1952f16390de
7
+ data.tar.gz: 9c7121c4d0f742fcfeb2331d3170de1ebadab101e512905a6fc63ca4fb6e5b3056609826396ac11b897fc415974589331d72c2a88a63b8f8acc5b6679c49da21
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in shevy.gemspec
4
+ gemspec
@@ -0,0 +1,46 @@
1
+ # Shevy
2
+
3
+ Shevy is a small Sass library for simple, configurable typography with perfect vertical rhythm.
4
+
5
+ This is Shevy in gem form. If you are looking for the original repo, go to [https://github.com/kyleshevlin/shevy](https://github.com/kyleshevlin/shevy).
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'shevy'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install shevy
22
+
23
+ ### Important
24
+
25
+ After the gem is installed, you will need to add Shevy to your `application.css` file.
26
+
27
+ ```
28
+ *= require shevy
29
+ ```
30
+
31
+ Add this _before_ your other styles so that the mixins are available.
32
+
33
+ ## Usage
34
+
35
+ Usage can be found at [https://github.com/kyleshevlin/shevy](https://github.com/kyleshevlin/shevy).
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
+
41
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kyleshevlin/shevy-gem.
46
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "shevy"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ require "shevy/version"
2
+
3
+ module Shevy
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module Shevy
2
+ VERSION = "1.0.1"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'shevy/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "shevy"
8
+ spec.version = Shevy::VERSION
9
+ spec.authors = ["Kyle Shevlin"]
10
+ spec.email = ["kyle.a.shevlin@gmail..com"]
11
+
12
+ spec.summary = %q{Sass library for typography and perfect vertical rhythm.}
13
+ spec.description = %q{Shevy is a small Sass library for simple, configurable typography with perfect vertical rhythm.}
14
+ spec.homepage = "https://github.com/kyleshevlin/shevy"
15
+ spec.licenses = ['MIT']
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
@@ -0,0 +1,13 @@
1
+ //////////////////////////////
2
+ // Shevy
3
+ // Version: 1.0.0
4
+ // Author: Kyle Shevlin
5
+ // Github: https://www.github.com/kyleshevlin
6
+ // Repo: https://www.github.com/kyleshevlin/shevy
7
+ //////////////////////////////
8
+
9
+ @import
10
+ 'shevy/shevy_variables',
11
+ 'shevy/shevy_functions',
12
+ 'shevy/shevy_mixins'
13
+ ;
@@ -0,0 +1,39 @@
1
+ //////////////////////////////
2
+ // Shevy Functions
3
+ //////////////////////////////
4
+
5
+ // Get font size from the font-scale
6
+ @function get-font-scale-value($iterator, $map: $shevy) {
7
+ @return nth(map-get($map, 'base-font-scale'), $iterator);
8
+ }
9
+
10
+ // Base Unit Multiplier
11
+ // Creates a 1(base-unit) to use for multiplying
12
+ @function base-unit-multiplier($unit) {
13
+ @if $unit == 'px' {
14
+ @return 1px;
15
+ } @else if $unit == 'em' {
16
+ @return 1em;
17
+ } @else if $unit == 'rem' {
18
+ @return 1rem;
19
+ } @else {
20
+ @warn "Sorry, but that's an unsupported unit of measure.";
21
+ }
22
+ }
23
+
24
+ // Base-spacing
25
+ // Allows the user to create spacing as multiples or dividends of the $base-spacing variable
26
+ @function base-spacing($factor: 1, $map: $shevy) {
27
+ // Merge defaults with provided map,
28
+ $_current_map: map-merge($shevy-defaults, $map);
29
+
30
+ $_base-font-size: map-get($_current_map, 'base-font-size');
31
+ $_base-line-height: map-get($_current_map, 'base-line-height');
32
+ $_base-spacing: $_base-font-size * $_base-line-height;
33
+
34
+ @return $_base-spacing * $factor;
35
+ }
36
+
37
+ @function bs($factor: 1, $map: $shevy) {
38
+ @return base-spacing($factor, $map);
39
+ }
@@ -0,0 +1,123 @@
1
+ //////////////////////////////
2
+ // Shevy Mixins
3
+ //////////////////////////////
4
+
5
+ // Headings
6
+ //////////////////////////////
7
+ @mixin headings($map: $shevy) {
8
+ // Merge defaults with provided map,
9
+ $_current_map: map-merge($shevy-defaults, $map);
10
+
11
+ // create private vars for map settings
12
+ $_base-font-unit: unit(map-get($_current_map, 'base-font-size'));
13
+ $_base-unit-multiplier: base-unit-multiplier($_base-font-unit);
14
+ $_base-font-size: map-get($_current_map, 'base-font-size');
15
+ $_base-line-height: map-get($_current_map, 'base-line-height');
16
+ $_base-spacing: $_base-font-size * $_base-line-height;
17
+ $_font-scale-length: length(map-get($_current_map, 'base-font-scale'));
18
+ $_margin_bottom_bool: map-get($_current_map, 'margin-bottom');
19
+
20
+ @for $i from 1 through $_font-scale-length {
21
+ h#{$i} {
22
+ // Font size is base-font-size * font-scale[index]
23
+ font-size: $_base-font-size * get-font-scale-value($i, $_current_map);
24
+
25
+ // Line-height calculation for pxs and rems is different than ems
26
+ @if $_base-font-unit == 'px' or $_base-font-unit == 'rem' {
27
+
28
+ // if font-size is greater than base-spacing
29
+ // more base-spacing will be necessary
30
+ @if ((get-font-scale-value($i, $_current_map) * $_base-font-size) <= $_base-spacing) {
31
+ line-height: $_base-spacing;
32
+ } @else {
33
+ $x: 1; // simple counter
34
+ // Half increments, while technically breaking the baseline, are more aesthetically pleasing and still mathematically useful
35
+ @while ($_base-spacing * ($x * .5)) <= (get-font-scale-value($i, $_current_map) * $_base-font-size) {
36
+ $x: $x + 1; // increment counter
37
+ }
38
+ // Half increments, while technically breaking the baseline, are more aesthetically pleasing and still mathematically useful
39
+ line-height: ($_base-spacing * ($x * .5));
40
+ }
41
+ } @else if $_base-font-unit == 'em' {
42
+
43
+ // if font-size is greater than base spacing
44
+ // more base-spacing will be necessary
45
+ @if ((get-font-scale-value($i, $_current_map) * $_base-unit-multiplier) <= $_base-spacing) {
46
+ line-height: $_base-spacing / (get-font-scale-value($i, $_current_map) * $_base-unit-multiplier); // * $_base-unit-multiplier removes base unit
47
+ } @else {
48
+ $y: 1; // simple counter, but Sass keeps vars in global scope, so we can't use $x
49
+ // Half increments, while technically breaking the baseline, are more aesthetically pleasing and still mathematically useful
50
+ @while ($_base-spacing * ($y * .5)) <= (get-font-scale-value($i, $_current_map) * $_base-unit-multiplier) {
51
+ $y: $y + 1; // increment counter
52
+ }
53
+ // Half increments, while technically breaking the baseline, are more aesthetically pleasing and still mathematically useful
54
+ line-height: ($_base-spacing * ($y * .5)) / (get-font-scale-value($i, $_current_map) * $_base-unit-multiplier); // * $_base-unit-multiplier removes base unit
55
+ }
56
+ } @else {
57
+ @warn "Sorry, but that's an unsupported unit of measure.";
58
+ }
59
+
60
+ // Margin-bottom
61
+ @if $_margin-bottom-bool {
62
+ @if $_base-font-unit == 'px' or $_base-font-unit == 'rem' {
63
+ margin-bottom: $_base-spacing;
64
+ } @else if $_base-font-unit == 'em' {
65
+ margin-bottom: $_base-spacing / get-font-scale-value($i, $_current_map);
66
+ } @else {
67
+ @warn "Sorry, but that's an unsupported unit of measure.";
68
+ }
69
+ } @else {
70
+ margin-bottom: 0;
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ // Paragraphs
77
+ //////////////////////////////
78
+ @mixin paragraph($supplied-map-for-paragraphs: $shevy) {
79
+ // Merge defaults with provided map,
80
+ $_current_map: map-merge($shevy-defaults, $supplied-map-for-paragraphs);
81
+
82
+ // create private vars for map settings
83
+ $_base-font-unit: unit(map-get($_current_map, 'base-font-size'));
84
+ $_base-font-size: map-get($_current_map, 'base-font-size');
85
+ $_base-line-height: map-get($_current_map, 'base-line-height');
86
+ $_base-spacing: $_base-font-size * $_base-line-height;
87
+ $_font-scale-length: length(map-get($_current_map, 'base-font-scale'));
88
+ $_paragraph-scale: map-get($_current_map, 'paragraph-scale');
89
+ $_margin_bottom_bool: map-get($_current_map, 'margin-bottom');
90
+
91
+ @if $_paragraph-scale == false {
92
+ $_paragraph-scale: get-font-scale-value($_font-scale-length, $_current_map);
93
+ } @else {
94
+ $_paragraph-scale: map-get($_current_map, 'paragraph-scale');
95
+ }
96
+
97
+ p {
98
+ // We use the last supplied font-size in the current map
99
+ font-size: $_base-font-size * $_paragraph-scale;
100
+
101
+ // Line Height
102
+ @if $_base-font-unit == 'px' or $_base-font-unit == 'rem' {
103
+ line-height: $_base-spacing;
104
+ } @else if $_base-font-unit == 'em' {
105
+ line-height: $_base-spacing / get-font-scale-value($_font-scale-length, $_current_map);
106
+ } @else {
107
+ @warn "Sorry, but that's an unsupported unit of measure.";
108
+ }
109
+
110
+ // Margin Bottom
111
+ @if $_margin-bottom-bool {
112
+ @if $_base-font-unit == 'px' or $_base-font-unit == 'rem' {
113
+ margin-bottom: $_base-spacing;
114
+ } @else if $_base-font-unit == 'em' {
115
+ margin-bottom: $_base-spacing / get-font-scale-value($_font-scale-length, $_current_map);
116
+ } @else {
117
+ @warn "Sorry, but that's an unsupported unit of measure.";
118
+ }
119
+ } @else {
120
+ margin-bottom: 0;
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,18 @@
1
+ //////////////////////////////
2
+ // Shevy Variables
3
+ //////////////////////////////
4
+
5
+ // Default settings
6
+ $shevy-defaults: (
7
+ base-font-size: 1em,
8
+ base-line-height: 1.5,
9
+ base-font-scale: (3, 2.5, 2, 1.5, 1.25, 1),
10
+ paragraph-scale: false,
11
+ margin-bottom: true
12
+ );
13
+
14
+ // Empty $shevy set as default in case one is not supplied by user
15
+ $shevy: () !default;
16
+
17
+ // Merge defaults with $shevy to create base level map
18
+ $shevy: map-merge($shevy-defaults, $shevy);
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shevy
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kyle Shevlin
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Shevy is a small Sass library for simple, configurable typography with
42
+ perfect vertical rhythm.
43
+ email:
44
+ - kyle.a.shevlin@gmail..com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - README.md
52
+ - Rakefile
53
+ - bin/console
54
+ - bin/setup
55
+ - lib/shevy.rb
56
+ - lib/shevy/version.rb
57
+ - shevy.gemspec
58
+ - vendor/assets/stylesheets/shevy.scss
59
+ - vendor/assets/stylesheets/shevy/_shevy_functions.scss
60
+ - vendor/assets/stylesheets/shevy/_shevy_mixins.scss
61
+ - vendor/assets/stylesheets/shevy/_shevy_variables.scss
62
+ homepage: https://github.com/kyleshevlin/shevy
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.4.8
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Sass library for typography and perfect vertical rhythm.
86
+ test_files: []