ronin-grid 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/LICENSE.md +11 -0
- data/README.md +119 -0
- data/Rakefile +1 -0
- data/app/assets/stylesheets/_ronin-grid.css.scss +4 -0
- data/app/assets/stylesheets/ronin-grid/_classes.scss +26 -0
- data/app/assets/stylesheets/ronin-grid/_grid.scss +128 -0
- data/app/assets/stylesheets/ronin-grid/_pixel_mixins.scss +3011 -0
- data/app/assets/stylesheets/ronin-grid/_setup.scss +13 -0
- data/bin/ronin-grid +5 -0
- data/lib/ronin-grid/engine.rb +5 -0
- data/lib/ronin-grid/generator.rb +80 -0
- data/lib/ronin-grid/version.rb +3 -0
- data/lib/ronin-grid.rb +18 -0
- data/lib/tasks/install.rake +11 -0
- data/ronin-grid.gemspec +24 -0
- metadata +81 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Copyright (c) 2012 Jonathan Clem
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
8
|
+
|
9
|
+
Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.
|
10
|
+
|
11
|
+
Contributors to this project agree to grant all rights to the copyright holder of the primary product. Attribution is maintained in the source control history of the product.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# Ronin
|
2
|
+
|
3
|
+
Ronin is a framework for creating responsive web designs with SASS.
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
### Rails >= 3.1
|
10
|
+
|
11
|
+
In your `Gemfile`:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'ronin-grid'
|
15
|
+
```
|
16
|
+
|
17
|
+
Import Ronin into your SASS stylesheets:
|
18
|
+
|
19
|
+
```scss
|
20
|
+
@import 'ronin-grid';
|
21
|
+
```
|
22
|
+
|
23
|
+
### Rails < 3.0.x
|
24
|
+
|
25
|
+
Install with Rake:
|
26
|
+
|
27
|
+
```
|
28
|
+
$ rake ronin-grid:install
|
29
|
+
```
|
30
|
+
|
31
|
+
Import Ronin into your SASS stylesheets:
|
32
|
+
|
33
|
+
```scss
|
34
|
+
@import 'ronin-grid'
|
35
|
+
```
|
36
|
+
|
37
|
+
---
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
Given the following HTML:
|
42
|
+
|
43
|
+
```html
|
44
|
+
<div class='page-container'>
|
45
|
+
<div id='some-content'>
|
46
|
+
<p>Lorem ipsum...</p>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div id='more-content'>
|
50
|
+
<p>Lorem ipsum...</p>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
```
|
54
|
+
|
55
|
+
Apply Ronin's `container` mixin to your content container, and the `cols` mixin to your content:
|
56
|
+
|
57
|
+
```scss
|
58
|
+
.page-container {
|
59
|
+
@include container;
|
60
|
+
}
|
61
|
+
|
62
|
+
#some-content {
|
63
|
+
@include cols(6);
|
64
|
+
}
|
65
|
+
|
66
|
+
#more-content {
|
67
|
+
@include cols(6);
|
68
|
+
}
|
69
|
+
```
|
70
|
+
|
71
|
+
Respond with media queries with ease, writing the queries explicitly or using Ronin's built-in mixins:
|
72
|
+
|
73
|
+
```scss
|
74
|
+
#some-content {
|
75
|
+
@include cols(6);
|
76
|
+
@media screen and (max-width: 480px) {
|
77
|
+
@include cols(12);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
#more-content {
|
82
|
+
@include cols(6);
|
83
|
+
@include respond-480(12);
|
84
|
+
}
|
85
|
+
```
|
86
|
+
---
|
87
|
+
|
88
|
+
## Advanced Usage
|
89
|
+
|
90
|
+
Ronin can be used as a starting point for a project-specific framework. The code is well-marked up and easily tailored to a project, and I'm around to provide support on [Twitter][twitter].
|
91
|
+
|
92
|
+
---
|
93
|
+
|
94
|
+
## About Breakpoints
|
95
|
+
|
96
|
+
I'm using the term loosely. "Breakpoint" is usually used to mean the point at which a site's layout breaks and media queries should be used to prevent breakage. I'm using it to mean a point at which adjusting content width would improve readability or usability on a page.
|
97
|
+
|
98
|
+
The [example page][grid_example_page] has a table of Ronin's default breakpoints and how they effect elements using the `cols` mixin.
|
99
|
+
|
100
|
+
---
|
101
|
+
|
102
|
+
## Limitations
|
103
|
+
|
104
|
+
Elements using the `cols` mixin cannot be nested inside of one another.
|
105
|
+
|
106
|
+
---
|
107
|
+
|
108
|
+
## Author & License
|
109
|
+
|
110
|
+
Ronin is by [Jonathan Clem][jonathan_clem].
|
111
|
+
|
112
|
+
Copyright (c) 2012, Jonathan Clem
|
113
|
+
|
114
|
+
All rights reserved.
|
115
|
+
|
116
|
+
Released under a [modified MIT license][license]
|
117
|
+
|
118
|
+
[twitter]: http://twitter.com/_clem
|
119
|
+
[license]: http://github.com/jclem/ronin-grid/tree/master/LICENSE.md
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/* Ronin Classes
|
2
|
+
* Use these CSS classes if you do not want to use
|
3
|
+
* Ronin's SASS mixins.
|
4
|
+
*
|
5
|
+
* Advantage: Smaller CSS files.
|
6
|
+
* Disadvantage: Non-semantic markup.
|
7
|
+
*/
|
8
|
+
|
9
|
+
/* .r-container
|
10
|
+
* Ronin's main container for holding the entire grid.
|
11
|
+
*
|
12
|
+
* Usage:
|
13
|
+
* <div class='r-container'>
|
14
|
+
*/
|
15
|
+
.r-container { @include container; }
|
16
|
+
|
17
|
+
/* .r-cols-n
|
18
|
+
* Specify the number of columns an element should take
|
19
|
+
* occupy.
|
20
|
+
*
|
21
|
+
* Usage:
|
22
|
+
* <div class='r-cols-6'>
|
23
|
+
*/
|
24
|
+
@for $cols from 1 through $num-columns {
|
25
|
+
.r-cols-#{$cols} { @include cols($cols); }
|
26
|
+
}
|
@@ -0,0 +1,128 @@
|
|
1
|
+
/* Ronin Grid
|
2
|
+
* The main code behind Ronin's grid is here.
|
3
|
+
*/
|
4
|
+
|
5
|
+
$gutter-width: ($container-width - $num-columns * $column-width) / $num_columns; /* Unit-less width of the horizontal gutter between Ronin column elements. */
|
6
|
+
$container-px-width: $container-width * 1px; /* Width of the Ronin container in pixels. */
|
7
|
+
$column-px-width: $column-width * 1px; /* Width of a Ronin column in pixels. */
|
8
|
+
$column-pct-width: ($column-width / $container-width) * 100%; /* Width of a Ronin column in percentage. */
|
9
|
+
$gutter-px-width: $gutter-width * 1px; /* Width of a Ronin gutter in pixels. */
|
10
|
+
$gutter-pct-width: ($gutter-width / $container-width) * 100%; /* Width of a Ronin gutter in percentage. */
|
11
|
+
|
12
|
+
/* container mixin
|
13
|
+
* A container element holds the entire grid layout.
|
14
|
+
*
|
15
|
+
* Usage:
|
16
|
+
* .page-container { @include container; }
|
17
|
+
*/
|
18
|
+
@mixin container {
|
19
|
+
width: 90%;
|
20
|
+
max-width: $container-px-width + $gutter-px-width;
|
21
|
+
margin: 0 auto;
|
22
|
+
|
23
|
+
/* The next two rules keep the container centered
|
24
|
+
* by shifting it to the left by half the width of a
|
25
|
+
* gutter. Doing this allows us to avoid having a "last"
|
26
|
+
* mixin that would have to be applied to the last element
|
27
|
+
* in every row in the layout.
|
28
|
+
*/
|
29
|
+
position: relative;
|
30
|
+
left: $gutter-pct-width / 2;
|
31
|
+
|
32
|
+
/* Ronin uses inline-block for its column elements. Since
|
33
|
+
* inline-blocks are inline elements, they must have word and
|
34
|
+
* letter-spacing adjusted so that newlines in HTML between
|
35
|
+
* column elements are ignored. These values are reset in the cols
|
36
|
+
* mixin.
|
37
|
+
*/
|
38
|
+
letter-spacing: -0.31em;
|
39
|
+
*letter-spacing: normal; /* IE < 8 */
|
40
|
+
word-spacing: -0.43em; /* IE < 8 */
|
41
|
+
}
|
42
|
+
|
43
|
+
@mixin cols($cols:$num-columns) {
|
44
|
+
display: inline-block;
|
45
|
+
zoom: 1; *display: inline; /* IE < 8 */
|
46
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
47
|
+
margin-right: $gutter-pct-width;
|
48
|
+
margin-bottom: $column-bottom-margin;
|
49
|
+
vertical-align: top;
|
50
|
+
|
51
|
+
/* Reset what is done in the container mixin for inline-block elements. */
|
52
|
+
letter-spacing: normal;
|
53
|
+
word-spacing: normal;
|
54
|
+
|
55
|
+
/* Ronin's default breakpoints and column responses. */
|
56
|
+
@if $auto-respond == true {
|
57
|
+
@if $cols >= 8 {
|
58
|
+
@media screen and (max-width: 1024px) {
|
59
|
+
$cols: 12;
|
60
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
@if $cols >= 4 and $cols < 8 {
|
65
|
+
@media screen and (max-width: 1024px) {
|
66
|
+
$cols: 6;
|
67
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
68
|
+
}
|
69
|
+
|
70
|
+
@media screen and (max-width: 768px) {
|
71
|
+
$cols: 12;
|
72
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
@if $cols >= 3 and $cols < 4 {
|
77
|
+
@media screen and (max-width: 1024px) {
|
78
|
+
$cols: 4;
|
79
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
80
|
+
}
|
81
|
+
|
82
|
+
@media screen and (max-width: 768px) {
|
83
|
+
$cols: 6;
|
84
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
85
|
+
}
|
86
|
+
|
87
|
+
@media screen and (max-width: 480px) {
|
88
|
+
$cols: 12;
|
89
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
@if $cols <= 2 {
|
94
|
+
@media screen and (max-width: 1024px) {
|
95
|
+
$cols: 3;
|
96
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
97
|
+
}
|
98
|
+
|
99
|
+
@media screen and (max-width: 768px) {
|
100
|
+
$cols: 4;
|
101
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
102
|
+
}
|
103
|
+
|
104
|
+
@media screen and (max-width: 480px) {
|
105
|
+
$cols: 6;
|
106
|
+
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
@media screen and (max-width: 479px) {
|
111
|
+
width: 100% - $gutter-pct-width;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
/* Custom column responses for Ronin's default breakpoints. */
|
117
|
+
@if $auto-respond == true {
|
118
|
+
@mixin respond-1024($cols) { @media screen and (max-width: 1024px) { width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1); } }
|
119
|
+
@mixin respond-768($cols) { @media screen and (max-width: 768px) { width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1); } }
|
120
|
+
@mixin respond-480($cols) { @media screen and (max-width: 480px) { width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1); } }
|
121
|
+
}
|
122
|
+
|
123
|
+
/* Function for simply getting the width (in percentage) of a number
|
124
|
+
* of columns + gutter right-margin.
|
125
|
+
*/
|
126
|
+
@function cols-width($cols) {
|
127
|
+
@return $column-pct-width * $cols + $gutter-pct-width * ($cols - 1) + $gutter-pct-width;
|
128
|
+
}
|