compass-lucid-grid 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -7
- data/stylesheets/lucid/_internal.scss +11 -11
- data/stylesheets/lucid/_public.scss +25 -12
- metadata +4 -4
data/README.md
CHANGED
@@ -154,19 +154,24 @@ Instead of applying styles directly to each grid element, whenever possible, Luc
|
|
154
154
|
|
155
155
|
This results in MUCH leaner compiled CSS, as it avoids needless repetition.
|
156
156
|
|
157
|
-
###Offset Positioning `+offset( $offset (int) )`
|
157
|
+
###Offset Positioning `+offset( $offset (int), $gutters (0 || none) )`
|
158
158
|
|
159
159
|
Sometimes, your layout needs a little bit of whitespace. Not a problem with Lucid:
|
160
160
|
|
161
161
|
```scss
|
162
162
|
.offset-to-the-right {
|
163
163
|
@include columns(6);
|
164
|
-
@include offset(3);
|
164
|
+
@include offset(3); // shifts element to the right 3 columns
|
165
165
|
}
|
166
166
|
|
167
167
|
.offset-to-the-left {
|
168
168
|
@include columns(6);
|
169
|
-
@include offset(-3);
|
169
|
+
@include offset(-3); // shifts element to the left 3 columns
|
170
|
+
}
|
171
|
+
|
172
|
+
.offset-gutterless {
|
173
|
+
@include columns(6, 0, none);
|
174
|
+
@include offset(3, none); // include 'none' or '0' when grid element is gutterless
|
170
175
|
}
|
171
176
|
```
|
172
177
|
|
@@ -224,7 +229,7 @@ With other grids, styling an inner `<div>` is often the cleanest method to accom
|
|
224
229
|
}
|
225
230
|
```
|
226
231
|
|
227
|
-
With Lucid, this practice is no longer necessary, as you can adjust the width of grid elements individually! Just add your total borders / padding together and pass
|
232
|
+
With Lucid, this practice is no longer necessary, as you can adjust the width of grid elements individually! Just add your total borders / padding together and pass the negative value as a mixin parameter. Like this:
|
228
233
|
|
229
234
|
```html
|
230
235
|
<div class="container">
|
@@ -236,7 +241,7 @@ With Lucid, this practice is no longer necessary, as you can adjust the width of
|
|
236
241
|
|
237
242
|
```scss
|
238
243
|
.look-ma-no-wrapper {
|
239
|
-
@include columns(3, 40px); // (1px + 19px) * 2
|
244
|
+
@include columns(3, -40px); // (1px + 19px) * 2
|
240
245
|
|
241
246
|
border: 1px solid #ccc;
|
242
247
|
padding: 19px;
|
@@ -245,13 +250,13 @@ With Lucid, this practice is no longer necessary, as you can adjust the width of
|
|
245
250
|
|
246
251
|
Note, adjusting the width of a grid element means that nesting other grid elements within is no longer guaranteed to add up correctly. You *can* make use of Lucid's `+grid-reinit` to define a new inner grid however!
|
247
252
|
|
248
|
-
###Gutterless Elements `+columns( $columns (int), $adjustment (px), $gutters (
|
253
|
+
###Gutterless Elements `+columns( $columns (int), $adjustment (px), $gutters (0 || none) )`
|
249
254
|
|
250
255
|
Sometimes, it's convenient to have grid units without gutters. For example, when you want to nest elements within other elements:
|
251
256
|
|
252
257
|
```scss
|
253
258
|
.gutterless {
|
254
|
-
@include columns(9, 0,
|
259
|
+
@include columns(9, 0, none); // $gutters can accept 'none' or '0'
|
255
260
|
|
256
261
|
.nested {
|
257
262
|
@include column(3);
|
@@ -60,16 +60,16 @@
|
|
60
60
|
// - applies shared grid element styles
|
61
61
|
// - used in .grid-element and .grid-gutterless @extend hooks
|
62
62
|
//
|
63
|
-
// $
|
63
|
+
// $gutters (px) whether to include gutters
|
64
64
|
//
|
65
65
|
|
66
|
-
@mixin _grid-element($
|
66
|
+
@mixin _grid-element($gutters) {
|
67
67
|
display: inline;
|
68
68
|
float: left;
|
69
69
|
|
70
|
-
@if $
|
71
|
-
margin-left: $
|
72
|
-
margin-right: $
|
70
|
+
@if $gutters > 0 {
|
71
|
+
margin-left: $gutters;
|
72
|
+
margin-right: $gutters;
|
73
73
|
}
|
74
74
|
}
|
75
75
|
|
@@ -78,13 +78,13 @@
|
|
78
78
|
// Grid Element Style
|
79
79
|
// - applies individual styles for each grid element
|
80
80
|
//
|
81
|
-
// $columns
|
82
|
-
// $adjustment
|
83
|
-
// $gutter
|
84
|
-
// $col-width
|
81
|
+
// $columns (int) number of columns to span
|
82
|
+
// $adjustment (px) adjustment to element width (to compensate for borders and padding)
|
83
|
+
// $gutter-width (px) whether to include gutters
|
84
|
+
// $col-width (px) calculated width of a single grid column
|
85
85
|
//
|
86
86
|
|
87
|
-
@mixin _grid-element-style($columns, $adjustment, $gutter, $col-width) {
|
88
|
-
width: ($columns * $col-width)
|
87
|
+
@mixin _grid-element-style($columns, $adjustment, $gutter-width, $col-width) {
|
88
|
+
width: ($columns * $col-width) + $adjustment - ($gutter-width * 2);
|
89
89
|
}
|
90
90
|
|
@@ -27,6 +27,7 @@
|
|
27
27
|
@return ($grid-width - (2 * ($grid-outer-gutter - $grid-gutter))) / $grid-columns;
|
28
28
|
}
|
29
29
|
|
30
|
+
|
30
31
|
//
|
31
32
|
// GRID BASIC USAGE
|
32
33
|
//----------------------------------------------------------------------------//
|
@@ -64,13 +65,19 @@
|
|
64
65
|
// - defines a grid element that spans one or more columns
|
65
66
|
// - if $columns is 0, only the float and margin are applied
|
66
67
|
//
|
67
|
-
// $columns (int)
|
68
|
-
// $adjustment (px)
|
69
|
-
// $gutters (
|
68
|
+
// $columns (int) number of columns to span
|
69
|
+
// $adjustment (px) adjustment to element width (to compensate for borders and padding)
|
70
|
+
// $gutters (0 || none) whether to include gutters
|
70
71
|
//
|
71
72
|
|
72
|
-
@mixin columns($columns, $adjustment: 0, $gutters:
|
73
|
-
@if $gutters ==
|
73
|
+
@mixin columns($columns, $adjustment: 0, $gutters: null) {
|
74
|
+
@if $gutters == none {
|
75
|
+
@extend #{$grid-hook-gutterless};
|
76
|
+
@if $columns > 0 {
|
77
|
+
@include _grid-element-style($columns, $adjustment, 0, grid-column-width());
|
78
|
+
}
|
79
|
+
}
|
80
|
+
@else if $gutters == 0 {
|
74
81
|
@extend #{$grid-hook-gutterless};
|
75
82
|
@if $columns > 0 {
|
76
83
|
@include _grid-element-style($columns, $adjustment, 0, grid-column-width());
|
@@ -107,14 +114,20 @@
|
|
107
114
|
// - shifts grid element to the left/right (-/+) by one or more columns
|
108
115
|
// - must be defined after +column
|
109
116
|
//
|
110
|
-
// $offset (int)
|
111
|
-
// $gutters (
|
117
|
+
// $offset (int) the number of columns to shift (positive to the right, negative to the left)
|
118
|
+
// $gutters (0 || none) whether the element has gutters
|
112
119
|
//
|
113
120
|
|
114
|
-
@mixin offset($offset, $gutters:
|
115
|
-
|
116
|
-
|
117
|
-
|
121
|
+
@mixin offset($offset, $gutters: null) {
|
122
|
+
@if $gutters == none {
|
123
|
+
margin-left: ($offset * grid-column-width());
|
124
|
+
}
|
125
|
+
@else if $gutters == 0 {
|
126
|
+
margin-left: ($offset * grid-column-width());
|
127
|
+
}
|
128
|
+
@else {
|
129
|
+
margin-left: ($offset * grid-column-width()) + $grid-gutter;
|
130
|
+
}
|
118
131
|
}
|
119
132
|
|
120
133
|
|
@@ -153,7 +166,7 @@
|
|
153
166
|
|
154
167
|
@if $gutterless == true {
|
155
168
|
@for $i from 1 through $grid-columns {
|
156
|
-
.#{$gutterless-prefix}#{$i} { @include columns($i, 0,
|
169
|
+
.#{$gutterless-prefix}#{$i} { @include columns($i, 0, 0); }
|
157
170
|
}
|
158
171
|
}
|
159
172
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compass-lucid-grid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-06-
|
12
|
+
date: 2011-06-30 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: compass
|
16
|
-
requirement: &
|
16
|
+
requirement: &78872390 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0.11'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *78872390
|
25
25
|
description: A Compass/SASS grid that outputs lean, semantic stylesheets. Avoids CSS
|
26
26
|
repetition on SASS compilation and reduces the need for wrapper <div>s.
|
27
27
|
email: yz@yifei.co
|