crispy-grid 0.3.1 → 0.4.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.
- data/README.md +130 -7
- data/stylesheets/_crispy-grid.sass +1 -0
- data/stylesheets/crispy/_grid.sass +5 -1
- metadata +27 -4
data/README.md
CHANGED
@@ -36,19 +36,17 @@ way.
|
|
36
36
|
|
37
37
|
Crispy tries to support you even if you go beyond the main grid.
|
38
38
|
|
39
|
-
## Usage
|
40
|
-
|
41
|
-
Pending. Please have a look at the source.
|
42
|
-
|
43
39
|
## Installation
|
44
40
|
|
45
41
|
1. In your Gemfile add:
|
46
42
|
|
47
|
-
gem 'crispy-grid'
|
43
|
+
``gem 'crispy-grid'``
|
48
44
|
|
49
|
-
2.
|
45
|
+
2. *Skip this step if you have Rails >= 3 and Compass >= 0.11.*
|
46
|
+
|
47
|
+
In your project configuration file (e.g. initializers/compass.rb, [you might want to](https://github.com/Compass/compass-rails/blob/stable/README.md#configuration) create one if it does not exist yet) add:
|
50
48
|
|
51
|
-
require 'crispy-grid'
|
49
|
+
``require 'crispy-grid'``
|
52
50
|
|
53
51
|
3. Customize and import the grid in your application stylesheet:
|
54
52
|
|
@@ -86,6 +84,131 @@ $grid-columns: 30, 24, 24, 13
|
|
86
84
|
@import crispy/grid
|
87
85
|
```
|
88
86
|
|
87
|
+
### Configuration for using border-box
|
88
|
+
|
89
|
+
By default, Crispy Grid mimics this more natural behavior for a box-sizing: content-box setting by doing calculations. If you start a new project and do not have to support IE7, we recommend you to use box-sizing: border-box instead.
|
90
|
+
When switching an old project to border-box-sizing you need to tell Crispy Grid so. This is as simple as initializing it with `$grid-box-sizing` like so
|
91
|
+
|
92
|
+
``` sass
|
93
|
+
...
|
94
|
+
$grid-box-sizing: border-box
|
95
|
+
|
96
|
+
// Import Crispy Grid below the configuration
|
97
|
+
...
|
98
|
+
```
|
99
|
+
|
100
|
+
Setting the `$grid-box-sizing` to `border-box` will tell the grid to
|
101
|
+
ignore its padding calculations as they are no longer needed when using
|
102
|
+
the `border-box` box-model. However this will not apply `border-box` to
|
103
|
+
your elements. Most likely you'll want to apply `border-box` to all your
|
104
|
+
elements. The way [Paul Irish recommends](http://www.paulirish.com/2012/box-sizing-border-box-ftw/) looks like this when using Compass.
|
105
|
+
|
106
|
+
``` sass
|
107
|
+
*
|
108
|
+
+box-sizing(border-box)
|
109
|
+
```
|
110
|
+
|
111
|
+
In most cases this will be the way to go. However, there might be the
|
112
|
+
edge cases where you don't want to apply `border-box` to all your
|
113
|
+
elements. That's why setting the box-model is not part of Crispy Grid's
|
114
|
+
`$grid-box-sizing` option.
|
115
|
+
|
116
|
+
## Usage
|
117
|
+
|
118
|
+
### Mixins
|
119
|
+
|
120
|
+
The only things you need to know for using Crispy Grid are these 3 mixins:
|
121
|
+
|
122
|
+
1. `+grid-container`
|
123
|
+
* Include this in your container element(s) that contain your whole grid.
|
124
|
+
2. `+column`
|
125
|
+
* This is the most important mixin. Include e.g. `+column(5)` to span 5 columns, each having a gutter to the right-hand side.
|
126
|
+
3. `+last`
|
127
|
+
* Use this to indicate that a column is the last one in a row. It just removes the right gutter.
|
128
|
+
|
129
|
+
Use might also find these mixins useful:
|
130
|
+
|
131
|
+
1. `+last-column`
|
132
|
+
* This combines `+column` and `+last`. You should favor it over the two in order to reduce CSS output.
|
133
|
+
2. `+row`
|
134
|
+
* Use this for columns that span the whole row. This mixin just calls `+column` with the configured count of `$grid-columns`.
|
135
|
+
|
136
|
+
### Options
|
137
|
+
|
138
|
+
#### Options for `+column`, `+last-column`, `+row`
|
139
|
+
* `$colspan`
|
140
|
+
* Specifies the number of grid columns the element should span
|
141
|
+
* If the element does not fit into the grid, you can also specify a fixed width.
|
142
|
+
* It is the only mandatory parameter.
|
143
|
+
* Examples: `+column(5)`, `+column(120px)`, `+row($colspan: 23)`
|
144
|
+
* `$device`
|
145
|
+
* Relevant if you have [configured multiple devices](#configuration-for-multiple-devices)
|
146
|
+
* Default: `default-device()` - that is the value of `$device` or the first one in `$devices`
|
147
|
+
* The device must be contained in your `$devices` configuration.
|
148
|
+
* Examples: `+column(3, $device: tablet)`, `+last-column(1, $device: handheld-320)`
|
149
|
+
* `$padding`
|
150
|
+
* Now the fun stuff: Even when you use the browser default setting `box-sizing: content-box`, it is ensured that you do not break the grid by setting padding or a border.
|
151
|
+
* Default: 0
|
152
|
+
* Reduces the resulting `width` attribute of your column (unless you configured `$grid-box-sizing: border-box`)
|
153
|
+
* It is applied to both left and right by default.
|
154
|
+
* `padding-top` and `padding-bottom` are out of scope - just set them separately.
|
155
|
+
* Just like `$colspan`, you can also specify a number of columns.
|
156
|
+
* Examples: `+column(5, $padding: 10px)`, `+column(10, $padding: 1)` - they will have the same overall width as `+column(5)` / `+column(10)`
|
157
|
+
* `$differing-right-padding`
|
158
|
+
* Override `$padding` for the right side or exclusively set `$padding` for the right side
|
159
|
+
* Default: false
|
160
|
+
* Examples: `+column(5, $padding: 10px, $differing-right-padding: 15px)`, `+column(5, $differing-right-padding: 10px)`
|
161
|
+
* `$border-width`
|
162
|
+
* Same principle as `$padding`
|
163
|
+
* This just sets the CSS `border-width` property when using `$grid-box-sizing: border-box`. Otherwise, it also effects the `width` property.
|
164
|
+
* `$differing-right-border-width`
|
165
|
+
* Same principle as `$differing-right-padding`
|
166
|
+
* `$gutter`
|
167
|
+
* Customize the gutter (i.e. right margin) of a column
|
168
|
+
* Default: `grid-gutter-width($device)`
|
169
|
+
* Does not affect the "inner gutters"; i.e. if your `grid-gutter-width()` is 10px, `+column(5, $gutter: 15px)` will just add 5px overall whitespace, not 5*5px.
|
170
|
+
* `$left-gutter`
|
171
|
+
* Normally, gutters are only right with Crispy Grid. But you might have your reasons.
|
172
|
+
* Default: false
|
173
|
+
* Examples: `+column(5, $gutter: 10px, $left-gutter: 10px)`, `+last-column($left-gutter: 10px)`
|
174
|
+
* `$subtract-border-from`
|
175
|
+
* Sometimes you could say `+column(10, $padding: 1)` if there wasn't a 1px border that tries to ruin your grid (because you rely on box-sizing: content-box).
|
176
|
+
* You can use e.g. `+column(10, $padding: 1, $border-width: 1px, $subtract-border-from: padding)` instead of `+column(10, $padding: 29px, $border-width: 1px)`.
|
177
|
+
* Default: false
|
178
|
+
* Possible values: `padding`, `left-padding`, `right-padding`, `gutter`, `left-gutter`, `right-gutter`
|
179
|
+
* Example: `+column(10, $border-width: 2px, $subtract-border-from: gutter)`
|
180
|
+
* This option does nothing useful when using `$grid-box-sizing: border-box`.
|
181
|
+
|
182
|
+
#### Options for `+grid-container`
|
183
|
+
* `$device`
|
184
|
+
* see above
|
185
|
+
* `$colspan`
|
186
|
+
* Default: `grid-columns($device)`
|
187
|
+
* see above
|
188
|
+
* `$padding: 0`
|
189
|
+
* Unlike with columns, paddings and borders of a container do not affect its inner width.
|
190
|
+
* So the real grid starts with within the container paddings
|
191
|
+
* Example: `+grid-container($colspan: 24, $padding: 30px)` still leaves 24 full columns to its content
|
192
|
+
* `$differing-right-padding`
|
193
|
+
* see above
|
194
|
+
* `$border-width`
|
195
|
+
* see above
|
196
|
+
* `$differing-border-width`
|
197
|
+
* see above
|
198
|
+
* `$left-margin`
|
199
|
+
* Normally containers should be horizontally centered on the page.
|
200
|
+
* Default: auto
|
201
|
+
* If you wish to enforce to have whitespace around your container even if the browser window is not bigger than your content, you should do so by setting `$padding`.
|
202
|
+
* `$right-margin`
|
203
|
+
* see above
|
204
|
+
* `clearfix`
|
205
|
+
* Clearfixing has to be done in order to enforce the container to enclose its content.
|
206
|
+
* Default: overflow
|
207
|
+
* Possible values: `overflow`, `pie`, `pie-clearfix` (same as `pie`)
|
208
|
+
* By default, the overflow: hidden method is used. This might get in your way when you have content that wants to 'break out' of your container.
|
209
|
+
* Specify `$clearfix: pie` if container contents should be visible outside of the container (e.g. when positioned absolutely).
|
210
|
+
* See the used [Compass clearfix lib](http://compass-style.org/reference/compass/utilities/general/clearfix/)
|
211
|
+
|
89
212
|
## Changelog
|
90
213
|
|
91
214
|
There is one. [Have a look at it](https://github.com/ChristianPeters/crispy-grid/blob/master/CHANGELOG.md).
|
@@ -9,6 +9,7 @@ $grid-column-widths: false !default
|
|
9
9
|
$grid-gutter-width: false !default
|
10
10
|
$grid-gutter-widths: false !default
|
11
11
|
$grid-columns: 24 !default
|
12
|
+
$grid-box-sizing: content-box !default
|
12
13
|
|
13
14
|
@function default-device()
|
14
15
|
@return $device or nth($devices, 1)
|
@@ -106,7 +107,10 @@ $grid-columns: 24 !default
|
|
106
107
|
width: $column-width
|
107
108
|
@else
|
108
109
|
// Paddings and borders do not affect the outer width of a column.
|
109
|
-
|
110
|
+
@if $grid-box-sizing == 'border-box'
|
111
|
+
width: $column-width
|
112
|
+
@else
|
113
|
+
width: $column-width - $padding-sum - $border-width-sum
|
110
114
|
|
111
115
|
// Setting other box attributes
|
112
116
|
padding:
|
metadata
CHANGED
@@ -1,16 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crispy-grid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Christian Peters
|
14
|
+
- Lucas Nolte
|
9
15
|
autorequire:
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
18
|
|
13
|
-
date:
|
19
|
+
date: 2013-10-28 00:00:00 +01:00
|
20
|
+
default_executable:
|
14
21
|
dependencies:
|
15
22
|
- !ruby/object:Gem::Dependency
|
16
23
|
name: compass
|
@@ -20,6 +27,10 @@ dependencies:
|
|
20
27
|
requirements:
|
21
28
|
- - ">="
|
22
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 29
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 11
|
23
34
|
version: "0.11"
|
24
35
|
type: :runtime
|
25
36
|
version_requirements: *id001
|
@@ -31,11 +42,16 @@ dependencies:
|
|
31
42
|
requirements:
|
32
43
|
- - ">="
|
33
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
46
|
+
segments:
|
47
|
+
- 3
|
48
|
+
- 1
|
49
|
+
- 2
|
34
50
|
version: 3.1.2
|
35
51
|
type: :runtime
|
36
52
|
version_requirements: *id002
|
37
53
|
description: In short, Crispy Grid closes the gap between easy-to-use grids for simple web pages and doing everything by hand due to layout complexity.
|
38
|
-
email:
|
54
|
+
email: crispy.dev@gmail.com
|
39
55
|
executables: []
|
40
56
|
|
41
57
|
extensions: []
|
@@ -50,6 +66,7 @@ files:
|
|
50
66
|
- stylesheets/crispy/_grid.sass
|
51
67
|
- templates/project/_crispy-grid.sass
|
52
68
|
- templates/project/manifest.rb
|
69
|
+
has_rdoc: true
|
53
70
|
homepage: https://github.com/ChristianPeters/crispy-grid
|
54
71
|
licenses: []
|
55
72
|
|
@@ -63,17 +80,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
80
|
requirements:
|
64
81
|
- - ">="
|
65
82
|
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
66
86
|
version: "0"
|
67
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
88
|
none: false
|
69
89
|
requirements:
|
70
90
|
- - ">="
|
71
91
|
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
72
95
|
version: "0"
|
73
96
|
requirements: []
|
74
97
|
|
75
98
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.
|
99
|
+
rubygems_version: 1.4.2
|
77
100
|
signing_key:
|
78
101
|
specification_version: 3
|
79
102
|
summary: A Compass-based Grid that strives for lean & sane CSS and supports complex layouts
|