compass-lucid-grid 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +248 -21
- data/stylesheets/_lucid.scss +11 -9
- data/stylesheets/lucid/_internal.scss +59 -35
- data/stylesheets/lucid/_public.scss +115 -34
- data/templates/project/_grid.scss +22 -39
- data/templates/project/manifest.rb +8 -32
- metadata +4 -4
data/README.md
CHANGED
@@ -1,41 +1,268 @@
|
|
1
|
-
#
|
1
|
+
#Lucid: A _smarter_ CSS grid for Compass
|
2
2
|
|
3
|
-
|
3
|
+
###Philosophy and Killer Features
|
4
4
|
|
5
|
-
|
5
|
+
CSS grids make web development easier... except when they don't.
|
6
6
|
|
7
|
-
|
8
|
-
* Think using "alpha" and "omega" is a hacky solution.
|
9
|
-
* Hate fighting with gutters to get their layouts aligned.
|
10
|
-
* Want to apply borders and padding to grid elements without wrapping `<div>`s.
|
11
|
-
* Want a grid that plays nice with @media queries.
|
7
|
+
Wrapping `<div>`s, `.alpha` `.omega` madness, and fighting with gutters to get layouts aligned... These are the compromises that developers are forced live with.
|
12
8
|
|
13
|
-
|
9
|
+
But NOT anymore. Lucid makes full use of [SASS](http://sass-lang.com/) and [Compass](http://compass-style.org/) in order to make CSS grids sane again.
|
14
10
|
|
15
|
-
|
16
|
-
* Lucid allow you to adjust the width of grid element via a mixin parameter.
|
17
|
-
* Full documenation coming soon.
|
18
|
-
* MIT License
|
11
|
+
Not only does it match other grids in functionality, but it also comes with a handful of unique features:
|
19
12
|
|
20
|
-
|
13
|
+
* Adjust grid dimensions / number of columns instantly through variables (as with all SASS grids)
|
14
|
+
* Add borders and padding _directly to your grid elements_ without using nested `<div>`s
|
15
|
+
* Use "gutterless" grid elements for nesting and precise styling
|
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
|
21
18
|
|
22
|
-
|
19
|
+
Go ahead! Judge for yourself:
|
20
|
+
|
21
|
+
#Installation
|
22
|
+
|
23
|
+
```bash
|
23
24
|
(sudo) gem install compass-lucid-grid
|
24
25
|
compass help -r lucid lucid
|
25
26
|
```
|
26
27
|
|
27
|
-
|
28
|
+
Then
|
28
29
|
|
29
|
-
```
|
30
|
+
```bash
|
30
31
|
cd your_existing_project
|
31
32
|
echo "require 'lucid'" >> config.rb
|
32
|
-
compass install -r lucid lucid
|
33
|
+
compass install -r lucid lucid
|
33
34
|
```
|
34
35
|
|
35
|
-
|
36
|
+
Or
|
36
37
|
|
37
|
-
```
|
38
|
+
```bash
|
38
39
|
compass create -r lucid --using lucid your_new_project
|
39
40
|
```
|
40
41
|
|
41
|
-
(Note: Creating a project with Lucid does not generate the default Compass stylesheets, only the
|
42
|
+
(Note: Creating a project with Lucid does not generate the default Compass stylesheets, only the `\_grid.scss` partial.)
|
43
|
+
|
44
|
+
#Documentation
|
45
|
+
|
46
|
+
###Setup
|
47
|
+
|
48
|
+
After installation, @include '_grid.scss' or copy its contents into your base file. It should look something like this:
|
49
|
+
|
50
|
+
```scss
|
51
|
+
// Remove the following line if Compass has already been included
|
52
|
+
@import "compass/utilities/general/clearfix";
|
53
|
+
|
54
|
+
// Grid dimensions
|
55
|
+
$grid-width: 990px;
|
56
|
+
$grid-columns: 12;
|
57
|
+
|
58
|
+
// The amount of margin to apply to each side of a grid element
|
59
|
+
$grid-gutter: 15px;
|
60
|
+
|
61
|
+
// The distance between the grid container and the first grid element
|
62
|
+
$grid-outer-gutter: 15px;
|
63
|
+
|
64
|
+
// Use "pie-clearfix", "overflow", or "none"?
|
65
|
+
$grid-clearfix: "pie-clearfix";
|
66
|
+
|
67
|
+
// Center rows?
|
68
|
+
$grid-centering: true;
|
69
|
+
|
70
|
+
// Include Lucid
|
71
|
+
@import 'lucid';
|
72
|
+
|
73
|
+
// Output 4 CSS classes that Lucid uses as @extend "hooks"
|
74
|
+
@include grid-init;
|
75
|
+
```
|
76
|
+
|
77
|
+
### Basic Usage
|
78
|
+
|
79
|
+
Now we're ready to style:
|
80
|
+
|
81
|
+
```scss
|
82
|
+
/* SCSS */
|
83
|
+
|
84
|
+
.container {
|
85
|
+
@include container; // defines grid container
|
86
|
+
background: blue;
|
87
|
+
|
88
|
+
.sidebar {
|
89
|
+
@include columns(3); // 3 column element
|
90
|
+
}
|
91
|
+
|
92
|
+
.main {
|
93
|
+
@include columns(9); // 9 column element
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
.another-container {
|
98
|
+
@include container; // yet another container
|
99
|
+
background: red;
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
/* Compiled CSS */
|
104
|
+
|
105
|
+
.grid-container,
|
106
|
+
.container,
|
107
|
+
.another-container {
|
108
|
+
// container styles
|
109
|
+
}
|
110
|
+
|
111
|
+
.grid-clearfix,
|
112
|
+
.grid-container,
|
113
|
+
.container,
|
114
|
+
.another-container {
|
115
|
+
// clearfix styles
|
116
|
+
}
|
117
|
+
|
118
|
+
.container {
|
119
|
+
background: blue;
|
120
|
+
}
|
121
|
+
|
122
|
+
.another-container {
|
123
|
+
background: red;
|
124
|
+
}
|
125
|
+
|
126
|
+
.grid-element,
|
127
|
+
.container .sidebar,
|
128
|
+
.container .main {
|
129
|
+
// float: left, display: inline, and styles common to all grid elements
|
130
|
+
}
|
131
|
+
|
132
|
+
.container .sidebar {
|
133
|
+
// 3 column width
|
134
|
+
}
|
135
|
+
|
136
|
+
.container .main {
|
137
|
+
// 3 column width
|
138
|
+
}
|
139
|
+
```
|
140
|
+
|
141
|
+
Did you get that?
|
142
|
+
|
143
|
+
Instead of applying styles directly to each grid element, whenever possible, Lucid groups grid selectors that contain the same styles.
|
144
|
+
|
145
|
+
This results in MUCH leaner compiled CSS, as it avoids needless repetition.
|
146
|
+
|
147
|
+
###Using with Borders and Padding
|
148
|
+
|
149
|
+
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
|
+
|
151
|
+
```html
|
152
|
+
<div class="container">
|
153
|
+
<div class="wrapper">
|
154
|
+
<div class="safe-to-style">
|
155
|
+
<!-- content -->
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
```
|
160
|
+
|
161
|
+
```scss
|
162
|
+
.wrapper {
|
163
|
+
// grid float, width, styles
|
164
|
+
}
|
165
|
+
|
166
|
+
.safe-to-style {
|
167
|
+
border: 1px solid #ccc;
|
168
|
+
padding: 19px;
|
169
|
+
}
|
170
|
+
```
|
171
|
+
|
172
|
+
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 it as a mixin parameter. Like this:
|
173
|
+
|
174
|
+
```html
|
175
|
+
<div class="container">
|
176
|
+
<div class="look-ma-no-wrapper">
|
177
|
+
<!-- content -->
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
```
|
181
|
+
|
182
|
+
```scss
|
183
|
+
.look-ma-no-wrapper {
|
184
|
+
@include columns(3, 40px); // (1px + 19px) * 2
|
185
|
+
|
186
|
+
border: 1px solid #ccc;
|
187
|
+
padding: 19px;
|
188
|
+
}
|
189
|
+
```
|
190
|
+
|
191
|
+
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
|
+
|
193
|
+
###Gutterless Elements
|
194
|
+
|
195
|
+
Sometimes, it's convenient to have grid units without gutters. For example, when you want to nest elements within other elements:
|
196
|
+
|
197
|
+
```scss
|
198
|
+
.gutterless {
|
199
|
+
@include columns(9, 0, false);
|
200
|
+
|
201
|
+
.nested {
|
202
|
+
@include column(3);
|
203
|
+
}
|
204
|
+
|
205
|
+
.also-nested {
|
206
|
+
@include column(6);
|
207
|
+
}
|
208
|
+
}
|
209
|
+
```
|
210
|
+
|
211
|
+
#Advanced
|
212
|
+
|
213
|
+
###Adapting to Media Queries
|
214
|
+
|
215
|
+
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
|
+
|
217
|
+
```scss
|
218
|
+
@include grid-init;
|
219
|
+
|
220
|
+
// full width grid
|
221
|
+
.container { @include container; }
|
222
|
+
.sidebar { @include column(3); }
|
223
|
+
.main { @include column(9); }
|
224
|
+
|
225
|
+
@media screen and (max-width: 480px) {
|
226
|
+
|
227
|
+
// redeclare one or more variables
|
228
|
+
$grid-width: 480px;
|
229
|
+
|
230
|
+
// outputs a single modified @extend hook
|
231
|
+
@include grid-reinit;
|
232
|
+
|
233
|
+
// same proportions as before, just smaller!
|
234
|
+
.container { @include container; }
|
235
|
+
.sidebar { @include column(3); }
|
236
|
+
.main { @include column(9); }
|
237
|
+
|
238
|
+
}
|
239
|
+
```
|
240
|
+
|
241
|
+
###Modifying @extend Hooks
|
242
|
+
|
243
|
+
As mentioned before, Lucid used @extend internally to achieve leaner stylesheets. In order to do this, `+grid-init` outputs four benign classes for @extend to "hook" onto. These classes can be modified (defaults shown):
|
244
|
+
|
245
|
+
```scss
|
246
|
+
$grid-hook-clearfix: ".grid-clearfix";
|
247
|
+
$grid-hook-container: ".grid-container";
|
248
|
+
$grid-hook-element: ".grid-element";
|
249
|
+
$grid-hook-gutterless: ".grid-column-gutterless";
|
250
|
+
```
|
251
|
+
|
252
|
+
###Unsemantic Class Names
|
253
|
+
|
254
|
+
For testing purposes, or for those who are unwilling to part with old ways, Lucid provides a class name generator mixin:
|
255
|
+
|
256
|
+
```scss
|
257
|
+
// where # is the number of columns
|
258
|
+
|
259
|
+
// outputs .g1 => .g#
|
260
|
+
@include grid-classes;
|
261
|
+
|
262
|
+
// outputs gutterless classes in addition (.gl1 => .gl#);
|
263
|
+
@include grid-classes(true);
|
264
|
+
|
265
|
+
// changes the class prefixes (outputs .grid-1 => .grid-# and .gutterless-1 => .gutterless-#)
|
266
|
+
@include grid-classes(true, 'grid-', 'gutterless-');
|
267
|
+
```
|
268
|
+
|
data/stylesheets/_lucid.scss
CHANGED
@@ -2,27 +2,29 @@
|
|
2
2
|
//
|
3
3
|
// THE LUCID GRID | SETUP
|
4
4
|
// plugin by Yifei Zhang [http://yifei.co]
|
5
|
+
// MIT License [https://github.com/ezYZ/lucid/blob/master/LICENSE.txt]
|
5
6
|
//
|
6
7
|
//============================================================================//
|
7
8
|
|
8
9
|
// Grid configuration
|
9
|
-
$grid-width:
|
10
|
+
$grid-width: 990px !default;
|
10
11
|
$grid-columns: 12 !default;
|
11
12
|
$grid-gutter: 15px !default;
|
12
|
-
$grid-outer-gutter:
|
13
|
+
$grid-outer-gutter: 15px !default;
|
13
14
|
|
14
|
-
//
|
15
|
-
$grid-hook-container: ".lucid-grid" !default;
|
16
|
-
$grid-hook-row: ".lucid-row" !default;
|
17
|
-
$grid-hook-column: ".lucid-column" !default;
|
18
|
-
$grid-hook-gutterless: ".lucid-gutterless" !default;
|
19
|
-
|
20
|
-
// Use "pie-clearfix" clearfix or "overflow" clearfix?
|
15
|
+
// Use "pie-clearfix", "overflow", or "none"?
|
21
16
|
$grid-clearfix: "pie-clearfix" !default;
|
22
17
|
|
23
18
|
// Center rows by default?
|
24
19
|
$grid-centering: true !default;
|
25
20
|
|
21
|
+
// @extend hook selectors
|
22
|
+
$grid-hook-clearfix: ".grid-clearfix" !default;
|
23
|
+
$grid-hook-container: ".grid-container" !default;
|
24
|
+
$grid-hook-element: ".grid-element" !default;
|
25
|
+
$grid-hook-gutterless: ".grid-column-gutterless" !default;
|
26
|
+
|
27
|
+
|
26
28
|
//
|
27
29
|
// Imports
|
28
30
|
//
|
@@ -2,65 +2,89 @@
|
|
2
2
|
//
|
3
3
|
// THE LUCID GRID | INTERNAL MIXINS
|
4
4
|
// plugin by Yifei Zhang [http://yifei.co]
|
5
|
+
// MIT License [https://github.com/ezYZ/lucid/blob/master/LICENSE.txt]
|
5
6
|
//
|
6
7
|
//============================================================================//
|
7
8
|
|
8
|
-
// Calculate the base grid "unit"
|
9
|
-
$grid-outer-padding: $grid-outer-gutter - $grid-gutter;
|
10
|
-
$grid-inner-width: $grid-width - (2 * $grid-outer-padding);
|
11
|
-
$gu: $grid-inner-width / $grid-columns;
|
12
9
|
|
10
|
+
//
|
11
|
+
// Grid Clearfix
|
12
|
+
// - sets preferred clearfix method
|
13
|
+
// - uses +clearfix or +pie-clearfix
|
14
|
+
//
|
15
|
+
// $clearfix (string/bool) type of clearfix to use ("pie-clearfix", "overflow", false)
|
16
|
+
//
|
17
|
+
|
18
|
+
@mixin _grid-clearfix($clearfix) {
|
19
|
+
@if $clearfix == 'overflow' {
|
20
|
+
@include clearfix;
|
21
|
+
}
|
22
|
+
@else {
|
23
|
+
@include pie-clearfix;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
//
|
13
29
|
// Grid Container
|
14
|
-
//
|
15
|
-
|
30
|
+
// - applies container width and options
|
31
|
+
// - used by the .grid-container @extend hook
|
32
|
+
//
|
33
|
+
// $clearfix (string/bool) type of clearfix to use ("pie-clearfix", "overflow", false)
|
34
|
+
// $centered (bool) whether to apply centering margins
|
35
|
+
// $outer (px) calculated width of container padding
|
36
|
+
// $width (px) calculated width of grid
|
37
|
+
//
|
38
|
+
|
39
|
+
@mixin _grid-container($clearfix, $centered, $outer, $width) {
|
40
|
+
@if $clearfix != false {
|
41
|
+
@extend #{$grid-hook-clearfix};
|
42
|
+
}
|
43
|
+
|
16
44
|
@if $centered == true {
|
17
45
|
margin-left: auto;
|
18
46
|
margin-right: auto;
|
19
47
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
48
|
+
|
49
|
+
@if $outer > 0 {
|
50
|
+
padding-left: $outer;
|
51
|
+
padding-right: $outer;
|
52
|
+
}
|
23
53
|
|
24
54
|
width: $width;
|
25
55
|
}
|
26
56
|
|
27
|
-
// Grid Rows
|
28
|
-
// Centered to create outer gutter appearance
|
29
|
-
// Applies clearfix (to contain floats)
|
30
|
-
@mixin _grid-row($clearfix) {
|
31
|
-
margin-left: auto;
|
32
|
-
margin-right: auto;
|
33
57
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
58
|
+
//
|
59
|
+
// Grid Element
|
60
|
+
// - applies shared grid element styles
|
61
|
+
// - used in .grid-element and .grid-gutterless @extend hooks
|
62
|
+
//
|
63
|
+
// $gutter (px) whether to include gutters
|
64
|
+
//
|
40
65
|
|
41
|
-
// Styles shared by all grid elements
|
42
|
-
// Optionally include gutter
|
43
66
|
@mixin _grid-element($gutter) {
|
44
67
|
display: inline;
|
45
68
|
float: left;
|
46
69
|
|
47
70
|
@if $gutter > 0 {
|
48
|
-
margin-left: $
|
49
|
-
margin-right: $
|
71
|
+
margin-left: $gutter;
|
72
|
+
margin-right: $gutter;
|
50
73
|
}
|
51
74
|
}
|
52
75
|
|
53
|
-
// Individual styles for each grid element
|
54
|
-
@mixin _grid-element-style($columns, $offset, $gutter, $adjustment) {
|
55
76
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
77
|
+
//
|
78
|
+
// Grid Element Style
|
79
|
+
// - applies individual styles for each grid element
|
80
|
+
//
|
81
|
+
// $columns (int) number of columns to span
|
82
|
+
// $adjustment (px) width to shrink the element by (to compensate for borders and padding)
|
83
|
+
// $gutter (px) width of gutter
|
84
|
+
// $col-width (px) calculated width of a single grid column
|
85
|
+
//
|
62
86
|
|
63
|
-
|
64
|
-
width: ($columns * $
|
87
|
+
@mixin _grid-element-style($columns, $adjustment, $gutter, $col-width) {
|
88
|
+
width: ($columns * $col-width) - $adjustment - ($gutter * 2);
|
65
89
|
}
|
66
90
|
|
@@ -2,72 +2,153 @@
|
|
2
2
|
//
|
3
3
|
// THE LUCID GRID | PUBLIC MIXINS
|
4
4
|
// plugin by Yifei Zhang [http://yifei.co]
|
5
|
+
// MIT License [https://github.com/ezYZ/lucid/blob/master/LICENSE.txt]
|
5
6
|
//
|
6
7
|
//============================================================================//
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
|
10
|
+
//
|
11
|
+
// GRID CALCULATIONS
|
12
|
+
//----------------------------------------------------------------------------//
|
13
|
+
|
14
|
+
|
15
|
+
// The difference between outer and inner gutters
|
16
|
+
@function grid-outer-padding() {
|
17
|
+
@return $grid-outer-gutter - $grid-gutter;
|
18
|
+
}
|
19
|
+
|
20
|
+
// The actual width that contains the grid
|
21
|
+
@function grid-actual-width() {
|
22
|
+
@return $grid-width - (2 * ($grid-outer-gutter - $grid-gutter));
|
23
|
+
}
|
24
|
+
|
25
|
+
// The full width of a single column
|
26
|
+
@function grid-column-width() {
|
27
|
+
@return ($grid-width - (2 * ($grid-outer-gutter - $grid-gutter))) / $grid-columns;
|
14
28
|
}
|
15
29
|
|
16
30
|
//
|
17
|
-
//
|
31
|
+
// GRID BASIC USAGE
|
32
|
+
//----------------------------------------------------------------------------//
|
33
|
+
|
34
|
+
|
35
|
+
//
|
36
|
+
// Grid Init
|
37
|
+
// - outputs 4 CSS selectors for use as @extend "hooks"
|
38
|
+
// - (required) must appear before other grid mixins
|
18
39
|
//
|
19
40
|
|
41
|
+
@mixin grid-init {
|
42
|
+
@if $grid-clearfix != 'none' {
|
43
|
+
#{$grid-hook-clearfix} { @include _grid-clearfix($grid-clearfix); }
|
44
|
+
}
|
45
|
+
#{$grid-hook-container} { @include _grid-container($grid-clearfix, $grid-centering, grid-outer-padding(), grid-actual-width()); }
|
46
|
+
#{$grid-hook-element} { @include _grid-element($grid-gutter); }
|
47
|
+
#{$grid-hook-gutterless} { @include _grid-element(0); }
|
48
|
+
}
|
49
|
+
|
50
|
+
|
51
|
+
//
|
20
52
|
// Container
|
21
|
-
|
53
|
+
// - adds selector to .grid-container and .grid-clearfix hooks
|
54
|
+
// - apply to the parent(s) of all floated grid elements
|
55
|
+
//
|
56
|
+
|
57
|
+
@mixin container {
|
22
58
|
@extend #{$grid-hook-container};
|
23
59
|
}
|
24
60
|
|
25
|
-
// Row
|
26
|
-
@mixin row {
|
27
|
-
@extend #{$grid-hook-row};
|
28
|
-
}
|
29
61
|
|
30
|
-
//
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
62
|
+
//
|
63
|
+
// Columns
|
64
|
+
// - defines a grid element that spans one or more columns
|
65
|
+
//
|
66
|
+
// $columns (int) number of columns to span
|
67
|
+
// $adjustment (px) amount to shrink width (to compensate for borders and padding)
|
68
|
+
// $gutters (bool) whether to include gutters
|
69
|
+
//
|
35
70
|
|
36
|
-
|
37
|
-
@
|
38
|
-
|
39
|
-
|
71
|
+
@mixin columns($columns, $adjustment: 0, $gutters: true) {
|
72
|
+
@if $gutters == false {
|
73
|
+
@extend #{$grid-hook-gutterless};
|
74
|
+
@include _grid-element-style($columns, $adjustment, 0, grid-column-width());
|
75
|
+
}
|
76
|
+
@else {
|
77
|
+
@extend #{$grid-hook-element};
|
78
|
+
@include _grid-element-style($columns, $adjustment, $grid-gutter, grid-column-width());
|
79
|
+
}
|
40
80
|
}
|
41
81
|
|
42
|
-
|
43
|
-
//
|
44
|
-
|
45
|
-
|
82
|
+
|
83
|
+
//
|
84
|
+
// GRID ELEMENT MODIFIERS
|
85
|
+
//----------------------------------------------------------------------------//
|
86
|
+
|
87
|
+
|
88
|
+
//
|
89
|
+
// Row Break
|
90
|
+
// - breaks grid element into a new row
|
91
|
+
//
|
92
|
+
// $clear (string) direction to clear ("left", "both")
|
93
|
+
//
|
94
|
+
|
95
|
+
@mixin row-break($clear: 'left') {
|
96
|
+
clear: unquote($clear);
|
46
97
|
}
|
47
98
|
|
99
|
+
|
48
100
|
//
|
49
|
-
//
|
101
|
+
// Offset
|
102
|
+
// - shifts grid element to the left/right (-/+) by one or more columns
|
103
|
+
// - must be defined after +column
|
104
|
+
//
|
105
|
+
// $offset (int) the number of columns to shift (positive to the right, negative to the left)
|
106
|
+
// $gutters (bool) whether the element has gutters
|
107
|
+
//
|
108
|
+
|
109
|
+
@mixin offset($offset, $gutters: true) {
|
110
|
+
$gutter: if($gutters == false, 0, $grid-gutter);
|
111
|
+
|
112
|
+
margin-left: ($offset * grid-column-width()) + $gutter;
|
113
|
+
}
|
114
|
+
|
115
|
+
|
50
116
|
//
|
117
|
+
// Other / Experimental
|
118
|
+
//----------------------------------------------------------------------------//
|
119
|
+
|
51
120
|
|
52
|
-
|
53
|
-
|
121
|
+
//
|
122
|
+
// Grid Reinit
|
123
|
+
// - outputs a modified .grid-container @extend hook for use within media queries, etc.
|
124
|
+
// - must come after redeclaration of one or more grid configuration variables
|
125
|
+
// ($grid-width, $grid-columns, $grid-gutter, $grid-outer-gutter)
|
126
|
+
// - does not redeclare clearfix, centering, or .grid-element hooks
|
127
|
+
//
|
54
128
|
|
55
|
-
|
129
|
+
@mixin grid-reinit {
|
130
|
+
#{$grid-hook-container} { @include _grid-container(false, false, grid-outer-padding(), grid-actual-width()); }
|
56
131
|
}
|
57
132
|
|
58
133
|
//
|
59
|
-
//
|
134
|
+
// Grid Classes
|
135
|
+
// - outputs a set of classes for use in markup
|
136
|
+
// - new rows require `clear: left;` to be added manually
|
137
|
+
// - not recommended under most circumstances
|
138
|
+
//
|
139
|
+
// $gutterless (bool) whether to output gutterless grid element classes
|
140
|
+
// $prefix (string) class name prefix for grid elements
|
141
|
+
// $gutterless-prefix (string) class name prefix for gutterless grid elements
|
60
142
|
//
|
61
143
|
|
62
144
|
@mixin grid-classes($gutterless: false, $prefix: 'g', $gutterless-prefix: 'gl') {
|
63
145
|
@for $i from 1 through $grid-columns {
|
64
|
-
.#{$prefix}#{$i} { @include
|
146
|
+
.#{$prefix}#{$i} { @include columns($i); }
|
65
147
|
}
|
66
148
|
|
67
|
-
@if $gutterless
|
149
|
+
@if $gutterless == true {
|
68
150
|
@for $i from 1 through $grid-columns {
|
69
|
-
.#{$gutterless-prefix}#{$i} { @include
|
151
|
+
.#{$gutterless-prefix}#{$i} { @include columns($i, 0, false); }
|
70
152
|
}
|
71
153
|
}
|
72
154
|
}
|
73
|
-
|
@@ -2,52 +2,35 @@
|
|
2
2
|
//
|
3
3
|
// THE LUCID GRID | QUICKSTART
|
4
4
|
// plugin by Yifei Zhang [http://yifei.co]
|
5
|
+
// MIT License [https://github.com/ezYZ/lucid/blob/master/LICENSE.txt]
|
5
6
|
//
|
6
7
|
// @import this into your project or paste into your base/bootstrap file
|
7
8
|
//
|
8
9
|
//============================================================================//
|
9
10
|
|
10
|
-
//
|
11
|
-
// Configuration and Initialization
|
12
|
-
//
|
13
|
-
// Already have Compass @imported? Go ahead and remove `clearfix`.
|
14
|
-
//
|
15
|
-
// Configuration $variables should be defined before Lucid is @imported.
|
16
|
-
// View the full list of options and defaults at [http://yifei.co/lucid]
|
17
|
-
//
|
18
11
|
|
12
|
+
// Remove the following line if Compass has already been included
|
19
13
|
@import "compass/utilities/general/clearfix";
|
20
|
-
@import 'lucid';
|
21
14
|
|
22
|
-
//
|
23
|
-
|
24
|
-
|
25
|
-
// Lucid uses SASS's @extend (internally!) in order to produce leaner compiled
|
26
|
-
// stylesheets*. The `grid-hooks` mixin generates four base classes that are
|
27
|
-
// reused by Lucid's other mixins through @extend.
|
28
|
-
//
|
29
|
-
// * @include misused leads to fat, repetative stylesheets. Lucid knows better.
|
30
|
-
//
|
15
|
+
// Grid dimensions
|
16
|
+
$grid-width: 990px;
|
17
|
+
$grid-columns: 12;
|
31
18
|
|
32
|
-
|
19
|
+
// The amount of margin to apply to each side of a grid element
|
20
|
+
$grid-gutter: 15px;
|
21
|
+
|
22
|
+
// The distance between the grid container and the first grid element
|
23
|
+
$grid-outer-gutter: 15px;
|
24
|
+
|
25
|
+
// Use "pie-clearfix", "overflow", or "none"?
|
26
|
+
$grid-clearfix: "pie-clearfix";
|
27
|
+
|
28
|
+
// Center rows?
|
29
|
+
$grid-centering: true;
|
30
|
+
|
31
|
+
// Include Lucid
|
32
|
+
@import 'lucid';
|
33
|
+
|
34
|
+
// Output 4 CSS classes that Lucid uses as @extend "hooks"
|
35
|
+
@include grid-init;
|
33
36
|
|
34
|
-
//============================================================================//
|
35
|
-
//
|
36
|
-
// BASIC USAGE
|
37
|
-
// For the full docs, visit [http://yifei.co/lucid]
|
38
|
-
//
|
39
|
-
// @include grid; // setup a new grid container
|
40
|
-
// @include row; // setup a new grid row
|
41
|
-
//
|
42
|
-
// @include col(3); // grid element that spans 3 columns
|
43
|
-
// @include col(3, 2); // shifted 2 columns to right
|
44
|
-
// @include col(3, 2, 20px); // subtract 20px from `width` to adjust for borders/padding
|
45
|
-
// @include col-gutterless(5, 2); // "gutterless" element, identical usage to `col()`
|
46
|
-
// @include col-widthless; // adds float and gutters only (useful for aligning headers, etc.)
|
47
|
-
//
|
48
|
-
// @include grid-classes; // generate .g* classes to use in markup
|
49
|
-
// @include grid-classes(true); // generate .g* and .gl* (gutterless) classes
|
50
|
-
//
|
51
|
-
// @include grid-adjustment($n); // reduce container to $n columns (width)
|
52
|
-
//
|
53
|
-
//============================================================================//
|
@@ -1,4 +1,4 @@
|
|
1
|
-
description "A Compass/SASS grid for
|
1
|
+
description "A Compass/SASS grid for devs who care about semantics."
|
2
2
|
|
3
3
|
discover :all
|
4
4
|
|
@@ -6,35 +6,15 @@ help %Q{
|
|
6
6
|
|
7
7
|
***
|
8
8
|
|
9
|
-
THE LUCID GRID
|
10
|
-
|
11
|
-
SETUP
|
12
|
-
|
13
|
-
@import 'lucid'
|
14
|
-
@include grid-hooks; // generate @extend hooks
|
15
|
-
|
16
|
-
|
17
|
-
BASIC USAGE
|
18
|
-
|
19
|
-
@include grid; // setup a new grid container
|
20
|
-
@include row; // setup a new grid row
|
21
|
-
|
22
|
-
@include col(3); // grid element that spans 3 columns
|
23
|
-
@include col(3, 2); // shifted 2 columns to right
|
24
|
-
@include col(3, 2, 20px); // subtract 20px from `width` to adjust for borders/padding
|
25
|
-
@include col-gutterless(5, 2); // "gutterless" element, identical usage to `col()`
|
26
|
-
@include col-widthless; // adds float and gutters only (useful for aligning headers, etc.)
|
9
|
+
THE LUCID GRID
|
10
|
+
plugin by Yifei Zhang [http://yifei.co]
|
27
11
|
|
28
|
-
|
29
|
-
@include grid-classes(true); // generate .g* and .gl* (gutterless) classes
|
12
|
+
A smarter CSS grid for Compass.
|
30
13
|
|
31
|
-
|
14
|
+
For detailed documentation and examples, visit [https://github.com/ezYZ/lucid]
|
32
15
|
|
33
16
|
***
|
34
17
|
|
35
|
-
For the full docs, visit [http://yifei.co/lucid]
|
36
|
-
To view the source, visit [https://github.com/ezYZ/lucid]
|
37
|
-
|
38
18
|
}
|
39
19
|
|
40
20
|
welcome_message %Q{
|
@@ -42,15 +22,11 @@ welcome_message %Q{
|
|
42
22
|
***
|
43
23
|
|
44
24
|
THE LUCID GRID
|
45
|
-
plugin by Yifei Zhang
|
46
|
-
|
47
|
-
Congrats! Your project templating life is about to become a lot saner.
|
25
|
+
plugin by Yifei Zhang [http://yifei.co]
|
48
26
|
|
49
|
-
|
50
|
-
http://yifei.co/lucid
|
27
|
+
A smarter CSS grid for Compass.
|
51
28
|
|
52
|
-
|
53
|
-
https://github.com/ezYZ/lucid
|
29
|
+
For detailed documentation and examples, visit [https://github.com/ezYZ/lucid]
|
54
30
|
|
55
31
|
***
|
56
32
|
|
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.4.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-
|
12
|
+
date: 2011-06-04 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: compass
|
16
|
-
requirement: &
|
16
|
+
requirement: &74705840 !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: *74705840
|
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
|