compass-lucid-grid 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +67 -12
  2. data/stylesheets/lucid/_public.scss +7 -2
  3. metadata +4 -4
data/README.md CHANGED
@@ -14,7 +14,7 @@ Not only does it match other grids in functionality, but it also comes with a ha
14
14
  * Add borders and padding _directly to your grid elements_ without using nested `<div>`s
15
15
  * Use "gutterless" grid elements for nesting and precise styling
16
16
  * Cater to multiple screen widths by reconfiguring Lucid inside media queries
17
- * Achieve leaner compiled CSS than other SASS grids, due to Lucid's internal [@extend](http://sass-lang.com/docs/yardoc/file.SASS\_REFERENCE.html#extend) logic
17
+ * Achieve leaner compiled CSS than other SASS grids, due to Lucid's internal [@extend](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#extend) logic
18
18
 
19
19
  Go ahead! Judge for yourself:
20
20
 
@@ -39,13 +39,13 @@ Or
39
39
  compass create -r lucid --using lucid your_new_project
40
40
  ```
41
41
 
42
- (Note: Creating a project with Lucid does not generate the default Compass stylesheets, only the `\_grid.scss` partial.)
42
+ (Note: Creating a project with Lucid does not generate the default Compass stylesheets, only the `_grid.scss` partial.)
43
43
 
44
44
  #Documentation
45
45
 
46
- ###Setup
46
+ ###Setup `+grid-init`
47
47
 
48
- After installation, @include '_grid.scss' or copy its contents into your base file. It should look something like this:
48
+ After installation, @import '_grid.scss' or copy its contents into your base file. It should look something like this:
49
49
 
50
50
  ```scss
51
51
  // Remove the following line if Compass has already been included
@@ -74,7 +74,7 @@ $grid-centering: true;
74
74
  @include grid-init;
75
75
  ```
76
76
 
77
- ### Basic Usage
77
+ ###Basic Usage `+container, +columns( $columns (int) )`
78
78
 
79
79
  Now we're ready to style:
80
80
 
@@ -92,6 +92,11 @@ Now we're ready to style:
92
92
  .main {
93
93
  @include columns(9); // 9 column element
94
94
  }
95
+
96
+ .custom {
97
+ @include columns(0); // custom width element (includes only float and gutters)
98
+ width: 123px;
99
+ }
95
100
  }
96
101
 
97
102
  .another-container {
@@ -125,8 +130,9 @@ Now we're ready to style:
125
130
 
126
131
  .grid-element,
127
132
  .container .sidebar,
128
- .container .main {
129
- // float: left, display: inline, and styles common to all grid elements
133
+ .container .main,
134
+ .container .custom {
135
+ // styles shared by all grid elements
130
136
  }
131
137
 
132
138
  .container .sidebar {
@@ -134,7 +140,11 @@ Now we're ready to style:
134
140
  }
135
141
 
136
142
  .container .main {
137
- // 3 column width
143
+ // 9 column width
144
+ }
145
+
146
+ .container .custom {
147
+ width: 123px; // custom width
138
148
  }
139
149
  ```
140
150
 
@@ -144,7 +154,52 @@ Instead of applying styles directly to each grid element, whenever possible, Luc
144
154
 
145
155
  This results in MUCH leaner compiled CSS, as it avoids needless repetition.
146
156
 
147
- ###Using with Borders and Padding
157
+ ###Offset Positioning `+offset( $offset (int) )`
158
+
159
+ Sometimes, your layout needs a little bit of whitespace. Not a problem with Lucid:
160
+
161
+ ```scss
162
+ .offset-to-the-right {
163
+ @include columns(6);
164
+ @include offset(3); // shifts element to the right 3 columns
165
+ }
166
+
167
+ .offset-to-the-left {
168
+ @include columns(6);
169
+ @include offset(-3); // shifts element to the left 3 columns
170
+ }
171
+ ```
172
+
173
+ Unlike other grids that use padding or relative positioning to achieve this, Lucid does it with just `margin-left`. That means the element itself can still safely recieve styling!
174
+
175
+ ###New Rows `+row-break`
176
+
177
+ Because of the way Lucid was designed, elements that exceed the width of the container will automatically wrap into the next row. If you want to insert a "row break" manually, it's dead simple:
178
+
179
+ ```scss
180
+ .container {
181
+ @include container; // 12 column container
182
+ // would normally accomodate all 4 children
183
+ .on-row-1 {
184
+ @include columns(3);
185
+ }
186
+
187
+ .also-on-row-1 {
188
+ @include columns(3);
189
+ }
190
+
191
+ .on-row-2 {
192
+ @include columns(3); // would have been on row 1
193
+ @include row-break; // +row-break puts it on row 2
194
+ }
195
+
196
+ .also-on-row-2 {
197
+ @include columns(3); // all following elements affected as well
198
+ }
199
+ }
200
+ ```
201
+
202
+ ###Using with Borders and Padding `+columns( $columns (int), $adjustment (px) )`
148
203
 
149
204
  With other grids, styling an inner `<div>` is often the cleanest method to accomodate borders and padding, since it preserves the width of the grid element:
150
205
 
@@ -190,7 +245,7 @@ With Lucid, this practice is no longer necessary, as you can adjust the width of
190
245
 
191
246
  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!
192
247
 
193
- ###Gutterless Elements
248
+ ###Gutterless Elements `+columns( $columns (int), $adjustment (px), $gutters (bool) )`
194
249
 
195
250
  Sometimes, it's convenient to have grid units without gutters. For example, when you want to nest elements within other elements:
196
251
 
@@ -210,7 +265,7 @@ Sometimes, it's convenient to have grid units without gutters. For example, when
210
265
 
211
266
  #Advanced
212
267
 
213
- ###Adapting to Media Queries
268
+ ###Media Queries and Grid Reformatting `+grid-reinit`
214
269
 
215
270
  Lucid uses pixels, which means that it's a fixed-width grid (percentages aren't precise enough). Fortunately, this doesn't mean that your sites have to be fixed-width:
216
271
 
@@ -249,7 +304,7 @@ $grid-hook-element: ".grid-element";
249
304
  $grid-hook-gutterless: ".grid-column-gutterless";
250
305
  ```
251
306
 
252
- ###Unsemantic Class Names
307
+ ###Unsemantic Class Names `+grid-classes( $gutterless (bool), $prefix (str), $prefix-gutterless (str) )`
253
308
 
254
309
  For testing purposes, or for those who are unwilling to part with old ways, Lucid provides a class name generator mixin:
255
310
 
@@ -62,6 +62,7 @@
62
62
  //
63
63
  // Columns
64
64
  // - defines a grid element that spans one or more columns
65
+ // - if $columns is 0, only the float and margin are applied
65
66
  //
66
67
  // $columns (int) number of columns to span
67
68
  // $adjustment (px) amount to shrink width (to compensate for borders and padding)
@@ -71,11 +72,15 @@
71
72
  @mixin columns($columns, $adjustment: 0, $gutters: true) {
72
73
  @if $gutters == false {
73
74
  @extend #{$grid-hook-gutterless};
74
- @include _grid-element-style($columns, $adjustment, 0, grid-column-width());
75
+ @if $columns > 0 {
76
+ @include _grid-element-style($columns, $adjustment, 0, grid-column-width());
77
+ }
75
78
  }
76
79
  @else {
77
80
  @extend #{$grid-hook-element};
78
- @include _grid-element-style($columns, $adjustment, $grid-gutter, grid-column-width());
81
+ @if $columns > 0 {
82
+ @include _grid-element-style($columns, $adjustment, $grid-gutter, grid-column-width());
83
+ }
79
84
  }
80
85
  }
81
86
 
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.0
4
+ version: 0.4.1
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-04 00:00:00.000000000Z
12
+ date: 2011-06-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: compass
16
- requirement: &74705840 !ruby/object:Gem::Requirement
16
+ requirement: &86143910 !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: *74705840
24
+ version_requirements: *86143910
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