shevy 1.0.1 → 2.0.0
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.
- checksums.yaml +4 -4
- data/.gitignore +4 -9
- data/Gruntfile.js +59 -0
- data/LICENSE.md +21 -0
- data/README.md +173 -19
- data/bower.json +35 -0
- data/core/_shevy.scss +12 -0
- data/core/_shevy_functions.scss +128 -0
- data/core/_shevy_mixins.scss +131 -0
- data/core/_shevy_variables.scss +20 -0
- data/demo/css/style.css +415 -0
- data/demo/dist/style.css +413 -0
- data/demo/index.html +126 -0
- data/demo/scss/style.scss +202 -0
- data/lib/shevy.rb +7 -5
- data/lib/shevy/generator.rb +81 -0
- data/lib/shevy/version.rb +1 -1
- data/package.json +34 -0
- data/sache.json +6 -0
- metadata +16 -6
- data/vendor/assets/stylesheets/shevy.scss +0 -13
- data/vendor/assets/stylesheets/shevy/_shevy_functions.scss +0 -39
- data/vendor/assets/stylesheets/shevy/_shevy_mixins.scss +0 -123
- data/vendor/assets/stylesheets/shevy/_shevy_variables.scss +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb629656009b4fd3f0f015048e0c19afbd06c51c
|
4
|
+
data.tar.gz: 7a08763f3b5dc323c143a50876e45692a8fc5683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d23197041b58c0b2fc94d29c04f94d16f797718500f0a67d570d9ef31ff9d98c1e957fcde9eff4a3eabd1b0638fe64be197ad5b1543ffd299976f96982783b0f
|
7
|
+
data.tar.gz: 3eb75e51c30f126ebb640199e6d7e1d649de08ad4f83ada7d55f0c6f28760568a9d39887bd1f6d566cd5f92ea982fe300e0a4877620d475a1dc0e1add0668a29
|
data/.gitignore
CHANGED
data/Gruntfile.js
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
module.exports = function(grunt) {
|
2
|
+
// Requires
|
3
|
+
require('load-grunt-tasks')(grunt);
|
4
|
+
|
5
|
+
// Empty init allows us to merge by feature, not by function
|
6
|
+
grunt.config.init({
|
7
|
+
pkg: grunt.file.readJSON('package.json')
|
8
|
+
});
|
9
|
+
|
10
|
+
// Local Server
|
11
|
+
grunt.config.merge({
|
12
|
+
connect: {
|
13
|
+
server: {
|
14
|
+
options: {
|
15
|
+
base : 'demo',
|
16
|
+
keepalive : true
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
});
|
21
|
+
|
22
|
+
// Style config
|
23
|
+
grunt.config.merge({
|
24
|
+
autoprefixer: {
|
25
|
+
dist: {
|
26
|
+
files: {
|
27
|
+
'demo/dist/style.css': 'demo/css/style.css'
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
|
32
|
+
sass: {
|
33
|
+
dist: {
|
34
|
+
options: {
|
35
|
+
style: 'expanded'
|
36
|
+
},
|
37
|
+
files: {
|
38
|
+
'demo/css/style.css': 'demo/scss/style.scss'
|
39
|
+
}
|
40
|
+
}
|
41
|
+
},
|
42
|
+
|
43
|
+
watch: {
|
44
|
+
options: {
|
45
|
+
livereload: true
|
46
|
+
},
|
47
|
+
css: {
|
48
|
+
files: '**/*.scss',
|
49
|
+
tasks: ['sass', 'autoprefixer'],
|
50
|
+
options: {
|
51
|
+
spawn: false
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
// Register Tasks
|
58
|
+
grunt.registerTask('default', ['sass', 'autoprefixer', 'watch']);
|
59
|
+
};
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Kyle Shevlin
|
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
CHANGED
@@ -1,46 +1,200 @@
|
|
1
1
|
# Shevy
|
2
2
|
|
3
|
-
|
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).
|
3
|
+
A simple, configurable Sass library for typography with perfect vertical rhythm.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
7
|
+
If you want to add this to a project, copy the `lib/` directory into the appropriate location in your app.
|
10
8
|
|
11
|
-
```
|
12
|
-
|
9
|
+
```
|
10
|
+
$ cp -R lib/ path/to/your/project
|
13
11
|
```
|
14
12
|
|
15
|
-
|
13
|
+
Then `@import` the `_shevy.scss` file into your project.
|
16
14
|
|
17
|
-
|
15
|
+
```scss
|
16
|
+
@import 'lib/shevy';
|
17
|
+
```
|
18
18
|
|
19
|
-
|
19
|
+
Be sure to place this _before_ any call to Shevy mixins and functions so that the Sass compiles without error.
|
20
20
|
|
21
|
-
|
21
|
+
#### Ruby on Rails
|
22
22
|
|
23
|
-
|
23
|
+
If you are using Ruby on Rails and would like to add Shevy to your project, you're in luck. Shevy is also a [Ruby Gem](https://rubygems.org/gems/shevy) and the repo can be found [here](https://github.com/kyleshevlin/shevy-gem). In your `Gemfile` add:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem 'shevy'
|
27
|
+
```
|
24
28
|
|
25
|
-
|
29
|
+
Then run:
|
30
|
+
|
31
|
+
```
|
32
|
+
$ bundle install
|
33
|
+
```
|
34
|
+
|
35
|
+
Once the gem is installed, add Shevy to your `application.css` file.
|
26
36
|
|
27
37
|
```
|
28
38
|
*= require shevy
|
29
39
|
```
|
30
40
|
|
31
|
-
|
41
|
+
And _then_ `@import` the `_shevy.scss` file into your project with:
|
42
|
+
|
43
|
+
```scss
|
44
|
+
@import 'shevy';
|
45
|
+
```
|
46
|
+
|
47
|
+
Once again, be sure to place this _before_ any call to Shevy mixins or functions so that the Sass compiles without error.
|
32
48
|
|
33
49
|
## Usage
|
34
50
|
|
35
|
-
|
51
|
+
Shevy comes packaged with default settings. So the simplest usage of Shevy is to call a few mixins.
|
52
|
+
|
53
|
+
```scss
|
54
|
+
@include headings;
|
55
|
+
@include body;
|
56
|
+
@include content;
|
57
|
+
```
|
58
|
+
|
59
|
+
This will output styles for all headings (`h1` to `h6`), several content tags (`p`, `ol`, `ul`, and `pre`), and set font-size and line-height for the `body` tag.. However, you may find that the default settings don't suit your project. Shevy allows you to configure settings globally and/or at the component level. Here's how:
|
60
|
+
|
61
|
+
### Global
|
62
|
+
|
63
|
+
Shevy mixins take a Sass map as one of the arguments. The default map is the `$shevy` map (`$shevy` is always defined, even if you don't define your own). Thus, to make global changes to your configuration, simply define your own `$shevy` map to override the default settings. Like so:
|
64
|
+
|
65
|
+
```scss
|
66
|
+
$shevy: (
|
67
|
+
base-font-size: 14px,
|
68
|
+
base-line-height: 1.5,
|
69
|
+
base-font-scale: (2.5, 2.1, 1.8, 1.5, 1.25, 1),
|
70
|
+
margin-bottom: true
|
71
|
+
);
|
72
|
+
```
|
73
|
+
|
74
|
+
Then, `@include` the `headings`, `body`, and `content` mixins in your code
|
75
|
+
|
76
|
+
```scss
|
77
|
+
@include headings;
|
78
|
+
@include body;
|
79
|
+
@include content;
|
80
|
+
```
|
81
|
+
|
82
|
+
Now marvel at your beautiful typography. Assuming you've put something on the page. You have put something on the page, haven't you?
|
83
|
+
|
84
|
+
### Component Level
|
85
|
+
|
86
|
+
You can also pass a custom map into the `headings` and `paragraph` mixin. This should enable you to make custom typography per module or responsive typography per breakpoint.
|
87
|
+
|
88
|
+
Define a new Shevy map:
|
89
|
+
|
90
|
+
```scss
|
91
|
+
$shevy-small: (
|
92
|
+
base-font-size: 12px,
|
93
|
+
base-line-height: 1.3,
|
94
|
+
base-font-scale: (2, 1.8, 1.6, 1.4, 1.2, 1)
|
95
|
+
);
|
96
|
+
```
|
97
|
+
|
98
|
+
Then call the any of the mixins, passing your new settings map as an argument:
|
99
|
+
|
100
|
+
```scss
|
101
|
+
.my_component {
|
102
|
+
@include headings($shevy-small);
|
103
|
+
@include content($shevy-small);
|
104
|
+
}
|
105
|
+
```
|
106
|
+
|
107
|
+
## Defaults
|
108
|
+
|
109
|
+
```scss
|
110
|
+
$shevy: (
|
111
|
+
base-font-size: 1em,
|
112
|
+
base-line-height: 1.5,
|
113
|
+
base-font-scale: (3, 2.5, 2, 1.5, 1.25, 1),
|
114
|
+
margin-bottom: true
|
115
|
+
);
|
116
|
+
```
|
117
|
+
|
118
|
+
### base-font-size
|
119
|
+
|
120
|
+
The `base-font-size` key is intended to be the standard font-size for the project. `font-scale` multiplies its value against the `base-font-size`.
|
121
|
+
|
122
|
+
### base-line-height
|
123
|
+
|
124
|
+
The `base-line-height` is the standard line-height. If this is set in pixels, this will be the base-spacing value for Shevy. If it is provided as a factor, such as `1.5`, it will be multiplied by the `base-font-size` to generate the base-spacing value.
|
125
|
+
|
126
|
+
### base-font-scale
|
127
|
+
|
128
|
+
This is a Sass list of factors to multiply by the `base-font-size` to generate the font-sizes for headings and paragraphs (if a `paragraph-scale` is not provided).
|
129
|
+
|
130
|
+
### margin-bottom
|
131
|
+
|
132
|
+
By default, margin bottoms are added to all typography to maintain the vertical rhythm. However, you may wish to remove these. In that case, setting `margin-bottom: false` in your map will set the `margin-bottom` property to `0` for each element.
|
133
|
+
|
134
|
+
## Functions
|
135
|
+
|
136
|
+
There are several public functions available to the developer to use as they please. Here is a list of them:
|
137
|
+
|
138
|
+
* `base-font-size()`, with alias `bsf()`
|
139
|
+
* `base-font-unit()`, with alias `bfu()`
|
140
|
+
* `base-line-height()`, with alias `blh()`
|
141
|
+
* `base-spacing()`, with alias `bs()`
|
142
|
+
* `settings()`
|
143
|
+
|
144
|
+
### base-font-size
|
145
|
+
|
146
|
+
`base-font-size()` will return the `base-font-size` setting in the $shevy map, or the map passed to the function as an argument.
|
147
|
+
|
148
|
+
### base-font-unit
|
149
|
+
|
150
|
+
`base-font-unit()` will determine whether the measurements have been defined in `px`, `em`, or `rem` and return the correct unit type. A map can be passed to the function as an argument.
|
151
|
+
|
152
|
+
### base-line-height
|
153
|
+
|
154
|
+
`base-line-height()` will return the `base-line-height` setting in the $shevy map, or the map passed ot the function as an argument.
|
155
|
+
|
156
|
+
### base-spacing
|
157
|
+
|
158
|
+
`base-spacing()` calculates the base spacing of the vertical rhythm by multiplying the base font size by the base line-height. A factor may be passed to the argument to return multiples or dividends of the base-spacing.
|
159
|
+
|
160
|
+
Example:
|
161
|
+
|
162
|
+
```scss
|
163
|
+
.button {
|
164
|
+
padding: bs(.5) bs(2);
|
165
|
+
}
|
166
|
+
```
|
167
|
+
|
168
|
+
A map of settings can be passed as the second argument to adjust the output.
|
169
|
+
|
170
|
+
### settings
|
171
|
+
|
172
|
+
`settings()` is a function utilized by Shevy to merge a map with the `$shevy-defaults` map. This ensures that the current map has all the settings it should. The user can use this to create new maps on the fly if they desire, though there isn't much of a purpose for that just yet.
|
173
|
+
|
174
|
+
## Support
|
175
|
+
|
176
|
+
Currently, Shevy supports `px`, `em`, and `rem` usage. Additional support for other measurement units may be added in the future.
|
36
177
|
|
37
|
-
##
|
178
|
+
## License
|
38
179
|
|
39
|
-
|
180
|
+
The MIT License (MIT)
|
40
181
|
|
41
|
-
|
182
|
+
Copyright (c) 2016 Kyle Shevlin
|
42
183
|
|
43
|
-
|
184
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
185
|
+
of this software and associated documentation files (the "Software"), to deal
|
186
|
+
in the Software without restriction, including without limitation the rights
|
187
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
188
|
+
copies of the Software, and to permit persons to whom the Software is
|
189
|
+
furnished to do so, subject to the following conditions:
|
44
190
|
|
45
|
-
|
191
|
+
The above copyright notice and this permission notice shall be included in all
|
192
|
+
copies or substantial portions of the Software.
|
46
193
|
|
194
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
195
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
196
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
197
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
198
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
199
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
200
|
+
SOFTWARE.
|
data/bower.json
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"authors": [
|
3
|
+
"Kyle Shevlin <kyle.a.shevlin@gmail.com>"
|
4
|
+
],
|
5
|
+
"description": "A simple, configurable Sass library for typography with perfect vertical rhythm.",
|
6
|
+
"homepage": "https://kyleshevlin.github.io/shevy",
|
7
|
+
"ignore": [
|
8
|
+
"**/.*",
|
9
|
+
"demo",
|
10
|
+
"Gruntfile.js",
|
11
|
+
"package.json",
|
12
|
+
"sache.json",
|
13
|
+
"shevy.gemspec",
|
14
|
+
"Rakefile",
|
15
|
+
"Gemfile",
|
16
|
+
"lib/",
|
17
|
+
"bin/"
|
18
|
+
],
|
19
|
+
"keywords": [
|
20
|
+
"css",
|
21
|
+
"mixins",
|
22
|
+
"sass",
|
23
|
+
"scss",
|
24
|
+
"typography",
|
25
|
+
"rhythm"
|
26
|
+
],
|
27
|
+
"license": "MIT",
|
28
|
+
"main": "core/_shevy.scss",
|
29
|
+
"name": "shevy",
|
30
|
+
"repository": {
|
31
|
+
"type": "git",
|
32
|
+
"url": "https://github.com/kyleshevlin/shevy.git"
|
33
|
+
},
|
34
|
+
"version": "2.0.0"
|
35
|
+
}
|
data/core/_shevy.scss
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
///
|
2
|
+
/// Returns the font scale value at a given position in the list
|
3
|
+
/// @access private
|
4
|
+
/// @param {Number} $position Position of scale value to retrieve
|
5
|
+
/// @param {Map} $map [$shevy] Map from which to retrieve font scale value
|
6
|
+
/// @return {Number} Font scale value at given position
|
7
|
+
///
|
8
|
+
@function get-font-scale-value($position, $map: $shevy) {
|
9
|
+
$settings: settings($map);
|
10
|
+
@return nth(map-get($settings, 'base-font-scale'), $position);
|
11
|
+
}
|
12
|
+
|
13
|
+
///
|
14
|
+
/// Returns the base font size of current settings
|
15
|
+
/// @access public
|
16
|
+
/// @param {Map} $map [$shevy] Map of settings
|
17
|
+
/// @return {Value} Value of base-font-size setting
|
18
|
+
///
|
19
|
+
@function base-font-size($map: $shevy) {
|
20
|
+
$settings: settings($map);
|
21
|
+
@return map-get($settings, 'base-font-size');
|
22
|
+
}
|
23
|
+
|
24
|
+
///
|
25
|
+
/// @alias base-font-size
|
26
|
+
///
|
27
|
+
@function bsf($map: $shevy) {
|
28
|
+
@return base-font-size($map);
|
29
|
+
}
|
30
|
+
|
31
|
+
///
|
32
|
+
/// Returns the base font unit of the current settings
|
33
|
+
/// @access public
|
34
|
+
/// @param {Map} $map [$shevy] Map of settings
|
35
|
+
/// @return {String} Unit value of base font size
|
36
|
+
///
|
37
|
+
@function base-font-unit($map: $shevy) {
|
38
|
+
$settings: settings($map);
|
39
|
+
@return unit(map-get($settings, 'base-font-size'));
|
40
|
+
}
|
41
|
+
|
42
|
+
///
|
43
|
+
/// @alias base-font-unit
|
44
|
+
///
|
45
|
+
@function bfu($map: $shevy) {
|
46
|
+
@return base-font-unit($map);
|
47
|
+
}
|
48
|
+
|
49
|
+
///
|
50
|
+
/// Returns the line-height of the current settings
|
51
|
+
/// @access public
|
52
|
+
/// @param {Map} $map [$shevy] Map of settings
|
53
|
+
/// @return {Number} Current base-line-height setting
|
54
|
+
///
|
55
|
+
@function base-line-height($map: $shevy) {
|
56
|
+
$settings: settings($map);
|
57
|
+
@return map-get($settings, 'base-line-height');
|
58
|
+
}
|
59
|
+
|
60
|
+
///
|
61
|
+
/// @alias base-line-height
|
62
|
+
///
|
63
|
+
@function blh($map: $shevy) {
|
64
|
+
@return base-line-height($map);
|
65
|
+
}
|
66
|
+
|
67
|
+
///
|
68
|
+
/// Takes a factor, multiplies it with the current settings base spacing to output values that are multiples or dividends of the current vertical rhythm
|
69
|
+
/// @access public
|
70
|
+
/// @param {Number} $factor [1] A factor with which to multiply the base-spacing value
|
71
|
+
/// @param {Map} $map [$shevy] Map of settings
|
72
|
+
/// @return {Value} Value of base-spacing multiplied by the factor provided
|
73
|
+
///
|
74
|
+
@function base-spacing($factor: 1, $map: $shevy) {
|
75
|
+
$settings: settings($map);
|
76
|
+
$base-spacing: base-spacing-math($settings);
|
77
|
+
|
78
|
+
@return $base-spacing * $factor;
|
79
|
+
}
|
80
|
+
|
81
|
+
///
|
82
|
+
/// @alias base-spacing
|
83
|
+
///
|
84
|
+
@function bs($factor: 1, $map: $shevy) {
|
85
|
+
@return base-spacing($factor, $map);
|
86
|
+
}
|
87
|
+
|
88
|
+
///
|
89
|
+
/// Calculates base spacing
|
90
|
+
/// @access private
|
91
|
+
/// @param {Map} $map [$shevy] Map of settings
|
92
|
+
/// @return {Value} Value of base-font-size multiplied by base-line-height
|
93
|
+
///
|
94
|
+
@function base-spacing-math($map: $shevy) {
|
95
|
+
$settings: settings($map);
|
96
|
+
$base-font-size: base-font-size($settings);
|
97
|
+
$base-line-height: base-line-height($settings);
|
98
|
+
|
99
|
+
@return $base-font-size * $base-line-height;
|
100
|
+
}
|
101
|
+
|
102
|
+
///
|
103
|
+
/// Creates a value equivalent to 1 of the base unit, i.e. if base unit is pixels, returns 1px
|
104
|
+
/// @access private
|
105
|
+
/// @param {String} $unit String of unit type. Options are: 'px', 'em', or 'rem'
|
106
|
+
/// @return {Value} a value of 1 in the given unit type
|
107
|
+
///
|
108
|
+
@function base-unit-multiplier($unit) {
|
109
|
+
@if $unit == 'px' {
|
110
|
+
@return 1px;
|
111
|
+
} @else if $unit == 'em' {
|
112
|
+
@return 1em;
|
113
|
+
} @else if $unit == 'rem' {
|
114
|
+
@return 1rem;
|
115
|
+
} @else {
|
116
|
+
@warn "Sorry, but that is not a supported unit of measure.";
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
///
|
121
|
+
/// Merge current settings map with Shevy defaults
|
122
|
+
/// @access public
|
123
|
+
/// @param {Map} $map [$shevy] Map of settings
|
124
|
+
/// @return {Map} Map of merged settings
|
125
|
+
///
|
126
|
+
@function settings($map: $shevy) {
|
127
|
+
@return map-merge($shevy-defaults, $map);
|
128
|
+
}
|