zen-grids 1.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt ADDED
@@ -0,0 +1,274 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+
3
+ Version 2, June 1991
4
+
5
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
6
+ Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
7
+ verbatim copies of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your freedom to
12
+ share and change it. By contrast, the GNU General Public License is
13
+ intended to guarantee your freedom to share and change free software--to
14
+ make sure the software is free for all its users. This General Public License
15
+ applies to most of the Free Software Foundation's software and to any other
16
+ program whose authors commit to using it. (Some other Free Software
17
+ Foundation software is covered by the GNU Library General Public License
18
+ instead.) You can apply it to your programs, too.
19
+
20
+ When we speak of free software, we are referring to freedom, not price. Our
21
+ General Public Licenses are designed to make sure that you have the
22
+ freedom to distribute copies of free software (and charge for this service if
23
+ you wish), that you receive source code or can get it if you want it, that you
24
+ can change the software or use pieces of it in new free programs; and that
25
+ you know you can do these things.
26
+
27
+ To protect your rights, we need to make restrictions that forbid anyone to
28
+ deny you these rights or to ask you to surrender the rights. These restrictions
29
+ translate to certain responsibilities for you if you distribute copies of the
30
+ software, or if you modify it.
31
+
32
+ For example, if you distribute copies of such a program, whether gratis or for
33
+ a fee, you must give the recipients all the rights that you have. You must make
34
+ sure that they, too, receive or can get the source code. And you must show
35
+ them these terms so they know their rights.
36
+
37
+ We protect your rights with two steps: (1) copyright the software, and (2)
38
+ offer you this license which gives you legal permission to copy, distribute
39
+ and/or modify the software.
40
+
41
+ Also, for each author's protection and ours, we want to make certain that
42
+ everyone understands that there is no warranty for this free software. If the
43
+ software is modified by someone else and passed on, we want its recipients
44
+ to know that what they have is not the original, so that any problems
45
+ introduced by others will not reflect on the original authors' reputations.
46
+
47
+ Finally, any free program is threatened constantly by software patents. We
48
+ wish to avoid the danger that redistributors of a free program will individually
49
+ obtain patent licenses, in effect making the program proprietary. To prevent
50
+ this, we have made it clear that any patent must be licensed for everyone's
51
+ free use or not licensed at all.
52
+
53
+ The precise terms and conditions for copying, distribution and modification
54
+ follow.
55
+
56
+ GNU GENERAL PUBLIC LICENSE
57
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
58
+ MODIFICATION
59
+
60
+ 0. This License applies to any program or other work which contains a notice
61
+ placed by the copyright holder saying it may be distributed under the terms
62
+ of this General Public License. The "Program", below, refers to any such
63
+ program or work, and a "work based on the Program" means either the
64
+ Program or any derivative work under copyright law: that is to say, a work
65
+ containing the Program or a portion of it, either verbatim or with
66
+ modifications and/or translated into another language. (Hereinafter, translation
67
+ is included without limitation in the term "modification".) Each licensee is
68
+ addressed as "you".
69
+
70
+ Activities other than copying, distribution and modification are not covered
71
+ by this License; they are outside its scope. The act of running the Program is
72
+ not restricted, and the output from the Program is covered only if its contents
73
+ constitute a work based on the Program (independent of having been made
74
+ by running the Program). Whether that is true depends on what the Program
75
+ does.
76
+
77
+ 1. You may copy and distribute verbatim copies of the Program's source
78
+ code as you receive it, in any medium, provided that you conspicuously and
79
+ appropriately publish on each copy an appropriate copyright notice and
80
+ disclaimer of warranty; keep intact all the notices that refer to this License
81
+ and to the absence of any warranty; and give any other recipients of the
82
+ Program a copy of this License along with the Program.
83
+
84
+ You may charge a fee for the physical act of transferring a copy, and you
85
+ may at your option offer warranty protection in exchange for a fee.
86
+
87
+ 2. You may modify your copy or copies of the Program or any portion of it,
88
+ thus forming a work based on the Program, and copy and distribute such
89
+ modifications or work under the terms of Section 1 above, provided that you
90
+ also meet all of these conditions:
91
+
92
+ a) You must cause the modified files to carry prominent notices stating that
93
+ you changed the files and the date of any change.
94
+
95
+ b) You must cause any work that you distribute or publish, that in whole or in
96
+ part contains or is derived from the Program or any part thereof, to be
97
+ licensed as a whole at no charge to all third parties under the terms of this
98
+ License.
99
+
100
+ c) If the modified program normally reads commands interactively when run,
101
+ you must cause it, when started running for such interactive use in the most
102
+ ordinary way, to print or display an announcement including an appropriate
103
+ copyright notice and a notice that there is no warranty (or else, saying that
104
+ you provide a warranty) and that users may redistribute the program under
105
+ these conditions, and telling the user how to view a copy of this License.
106
+ (Exception: if the Program itself is interactive but does not normally print such
107
+ an announcement, your work based on the Program is not required to print
108
+ an announcement.)
109
+
110
+ These requirements apply to the modified work as a whole. If identifiable
111
+ sections of that work are not derived from the Program, and can be
112
+ reasonably considered independent and separate works in themselves, then
113
+ this License, and its terms, do not apply to those sections when you distribute
114
+ them as separate works. But when you distribute the same sections as part
115
+ of a whole which is a work based on the Program, the distribution of the
116
+ whole must be on the terms of this License, whose permissions for other
117
+ licensees extend to the entire whole, and thus to each and every part
118
+ regardless of who wrote it.
119
+
120
+ Thus, it is not the intent of this section to claim rights or contest your rights to
121
+ work written entirely by you; rather, the intent is to exercise the right to
122
+ control the distribution of derivative or collective works based on the
123
+ Program.
124
+
125
+ In addition, mere aggregation of another work not based on the Program
126
+ with the Program (or with a work based on the Program) on a volume of a
127
+ storage or distribution medium does not bring the other work under the scope
128
+ of this License.
129
+
130
+ 3. You may copy and distribute the Program (or a work based on it, under
131
+ Section 2) in object code or executable form under the terms of Sections 1
132
+ and 2 above provided that you also do one of the following:
133
+
134
+ a) Accompany it with the complete corresponding machine-readable source
135
+ code, which must be distributed under the terms of Sections 1 and 2 above
136
+ on a medium customarily used for software interchange; or,
137
+
138
+ b) Accompany it with a written offer, valid for at least three years, to give
139
+ any third party, for a charge no more than your cost of physically performing
140
+ source distribution, a complete machine-readable copy of the corresponding
141
+ source code, to be distributed under the terms of Sections 1 and 2 above on
142
+ a medium customarily used for software interchange; or,
143
+
144
+ c) Accompany it with the information you received as to the offer to distribute
145
+ corresponding source code. (This alternative is allowed only for
146
+ noncommercial distribution and only if you received the program in object
147
+ code or executable form with such an offer, in accord with Subsection b
148
+ above.)
149
+
150
+ The source code for a work means the preferred form of the work for
151
+ making modifications to it. For an executable work, complete source code
152
+ means all the source code for all modules it contains, plus any associated
153
+ interface definition files, plus the scripts used to control compilation and
154
+ installation of the executable. However, as a special exception, the source
155
+ code distributed need not include anything that is normally distributed (in
156
+ either source or binary form) with the major components (compiler, kernel,
157
+ and so on) of the operating system on which the executable runs, unless that
158
+ component itself accompanies the executable.
159
+
160
+ If distribution of executable or object code is made by offering access to
161
+ copy from a designated place, then offering equivalent access to copy the
162
+ source code from the same place counts as distribution of the source code,
163
+ even though third parties are not compelled to copy the source along with the
164
+ object code.
165
+
166
+ 4. You may not copy, modify, sublicense, or distribute the Program except as
167
+ expressly provided under this License. Any attempt otherwise to copy,
168
+ modify, sublicense or distribute the Program is void, and will automatically
169
+ terminate your rights under this License. However, parties who have received
170
+ copies, or rights, from you under this License will not have their licenses
171
+ terminated so long as such parties remain in full compliance.
172
+
173
+ 5. You are not required to accept this License, since you have not signed it.
174
+ However, nothing else grants you permission to modify or distribute the
175
+ Program or its derivative works. These actions are prohibited by law if you
176
+ do not accept this License. Therefore, by modifying or distributing the
177
+ Program (or any work based on the Program), you indicate your acceptance
178
+ of this License to do so, and all its terms and conditions for copying,
179
+ distributing or modifying the Program or works based on it.
180
+
181
+ 6. Each time you redistribute the Program (or any work based on the
182
+ Program), the recipient automatically receives a license from the original
183
+ licensor to copy, distribute or modify the Program subject to these terms and
184
+ conditions. You may not impose any further restrictions on the recipients'
185
+ exercise of the rights granted herein. You are not responsible for enforcing
186
+ compliance by third parties to this License.
187
+
188
+ 7. If, as a consequence of a court judgment or allegation of patent
189
+ infringement or for any other reason (not limited to patent issues), conditions
190
+ are imposed on you (whether by court order, agreement or otherwise) that
191
+ contradict the conditions of this License, they do not excuse you from the
192
+ conditions of this License. If you cannot distribute so as to satisfy
193
+ simultaneously your obligations under this License and any other pertinent
194
+ obligations, then as a consequence you may not distribute the Program at all.
195
+ For example, if a patent license would not permit royalty-free redistribution
196
+ of the Program by all those who receive copies directly or indirectly through
197
+ you, then the only way you could satisfy both it and this License would be to
198
+ refrain entirely from distribution of the Program.
199
+
200
+ If any portion of this section is held invalid or unenforceable under any
201
+ particular circumstance, the balance of the section is intended to apply and
202
+ the section as a whole is intended to apply in other circumstances.
203
+
204
+ It is not the purpose of this section to induce you to infringe any patents or
205
+ other property right claims or to contest validity of any such claims; this
206
+ section has the sole purpose of protecting the integrity of the free software
207
+ distribution system, which is implemented by public license practices. Many
208
+ people have made generous contributions to the wide range of software
209
+ distributed through that system in reliance on consistent application of that
210
+ system; it is up to the author/donor to decide if he or she is willing to
211
+ distribute software through any other system and a licensee cannot impose
212
+ that choice.
213
+
214
+ This section is intended to make thoroughly clear what is believed to be a
215
+ consequence of the rest of this License.
216
+
217
+ 8. If the distribution and/or use of the Program is restricted in certain
218
+ countries either by patents or by copyrighted interfaces, the original copyright
219
+ holder who places the Program under this License may add an explicit
220
+ geographical distribution limitation excluding those countries, so that
221
+ distribution is permitted only in or among countries not thus excluded. In such
222
+ case, this License incorporates the limitation as if written in the body of this
223
+ License.
224
+
225
+ 9. The Free Software Foundation may publish revised and/or new versions
226
+ of the General Public License from time to time. Such new versions will be
227
+ similar in spirit to the present version, but may differ in detail to address new
228
+ problems or concerns.
229
+
230
+ Each version is given a distinguishing version number. If the Program specifies
231
+ a version number of this License which applies to it and "any later version",
232
+ you have the option of following the terms and conditions either of that
233
+ version or of any later version published by the Free Software Foundation. If
234
+ the Program does not specify a version number of this License, you may
235
+ choose any version ever published by the Free Software Foundation.
236
+
237
+ 10. If you wish to incorporate parts of the Program into other free programs
238
+ whose distribution conditions are different, write to the author to ask for
239
+ permission. For software which is copyrighted by the Free Software
240
+ Foundation, write to the Free Software Foundation; we sometimes make
241
+ exceptions for this. Our decision will be guided by the two goals of
242
+ preserving the free status of all derivatives of our free software and of
243
+ promoting the sharing and reuse of software generally.
244
+
245
+ NO WARRANTY
246
+
247
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE,
248
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT
249
+ PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
250
+ STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
251
+ OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
252
+ WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
253
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
254
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
255
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
256
+ PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
257
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
258
+ NECESSARY SERVICING, REPAIR OR CORRECTION.
259
+
260
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR
261
+ AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR
262
+ ANY OTHER PARTY WHO MAY MODIFY AND/OR
263
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
264
+ LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
265
+ SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
266
+ ARISING OUT OF THE USE OR INABILITY TO USE THE
267
+ PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
268
+ OR DATA BEING RENDERED INACCURATE OR LOSSES
269
+ SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
270
+ PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN
271
+ IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
272
+ THE POSSIBILITY OF SUCH DAMAGES.
273
+
274
+ END OF TERMS AND CONDITIONS
data/README.txt ADDED
@@ -0,0 +1,65 @@
1
+ ABOUT zen-grids
2
+ ---------------
3
+
4
+ The Zen Grids system is a fluid responsive grid system that is immune to
5
+ rounding errors and overflowing content. With an easy-to-use Sass mixin set, the
6
+ Zen Grids system can be applied to an infinite number of layouts.
7
+
8
+
9
+ USAGE
10
+ -----
11
+
12
+ A simple example: a content column with a sidebar on each side, aligned to a 12
13
+ column grid.
14
+
15
+ @import "zen";
16
+
17
+ $zen-column-count: 12; // Set the total number of columns in the grid.
18
+ $zen-gutter-width: 30px; // Set the gutter size. A half-gutter is used on
19
+ // each side of each column.
20
+
21
+ .container {
22
+ @include zen-grid-container();
23
+ }
24
+ .sidebar1 {
25
+ @include zen-grid(1, 3); // 3 col. wide sidebar starting in the 1st column
26
+ }
27
+ .content {
28
+ @include zen-grid(4, 6); // 6 col. wide element starting in the 4th column
29
+ }
30
+ .sidebar2 {
31
+ @include zen-grid(10, 3); // 3 col. wide sidebar starting in the 10th column
32
+ }
33
+
34
+ Within the .container element, the .sidebar1, .sidebar2 and .content elements
35
+ can be in any order.
36
+
37
+
38
+ INSTALLATION
39
+ ------------
40
+
41
+ Zen grids is distributed as a Ruby Gem. On your computer, simply run:
42
+
43
+ sudo gem install zen-grids
44
+
45
+ Then to add it to an existing project, edit the project's configuration file,
46
+ config.rb, and add this line:
47
+
48
+ require 'zen-grids'
49
+
50
+ And then, from the project's root directory, run:
51
+
52
+ compass install zen-grids
53
+
54
+
55
+ REQUIREMENTS
56
+ ------------
57
+
58
+ - Sass 3.1 or later
59
+ - Compass 0.11 or later
60
+
61
+
62
+ LICENSE
63
+ -------
64
+
65
+ Available under the GPL v2 license. See LICENSE.txt.
data/lib/zen-grids.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'compass'
2
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
3
+ Compass::Frameworks.register('zen-grids', :path => extension_path)
@@ -0,0 +1,3 @@
1
+ // Import the partial for Zen Grids, but not for Zen Columns.
2
+
3
+ @import "zen/grids";
@@ -0,0 +1,253 @@
1
+ //
2
+ // Mixins for Zen Columns layout method.
3
+ //
4
+
5
+ $zen-columns-box-sizing: content-box !default;
6
+ $legacy-support-for-ie6: true !default;
7
+
8
+
9
+ //
10
+ // This mixin should be applied to a container so that the children elements
11
+ // become columns arranged with the Zen Columns layout method.
12
+ //
13
+ // The mixin has the following required parameters:
14
+ // - $selectors: A list of selectors for all the columns inside the container.
15
+ // In this list, order the columns as you would like them to appear from
16
+ // left-to-right (or right-to-left when the $leading-direction is "right".)
17
+ // Note that the HTML for the columns can be in any order in the HTML source.
18
+ // - $widths: A list of widths. Each one corresponds to a column specified in
19
+ // $selectors. e.g. The first width is for the first column. The second width
20
+ // is for the second column. etc.
21
+ //
22
+ // The mixin has the following optional parameters:
23
+ // - $box-sizing: The type of CSS3 box model each column should use. Can be set
24
+ // to content-box or border-box. Defaults to content-box, but border-box is
25
+ // way cooler. IE 6 and 7 don't support border-box.
26
+ // - $leading-direction: The direction the columns should float. Can be set to
27
+ // "left" or "right". An extremely advanced option allows you to specify a
28
+ // a list of directions, one direction for each column.
29
+ // - $leading-gutters: A list of leading gutters; one per column. The leading
30
+ // gutter specifies the distance between the current column and the column
31
+ // floated just before it.
32
+ // - $padding: A list of padding measurements; one per column. In order to
33
+ // specify a complex padding value like "0 4px 2px", you can use nested lists,
34
+ // e.g. $padding: ((0 4px 2px), (3px 0), (10px 5px 5px 10px))
35
+ // In order to use the same padding measurements for all columns, you can
36
+ // simply list one measurement total instead of one per column,
37
+ // e.g. $padding: ((5px 10px))
38
+ //
39
+ // In addition to standard columns, the mixin supports one horizontal navbar
40
+ // that will appear (with a fixed height) above all the other columns. The
41
+ // parameters for this optional navbar are:
42
+ // - $navbar-selector: The selector for the navbar. It should be a child element
43
+ // of the container just as a normal column is.
44
+ // - $navbar-height: The fixed height of the navbar. Required if the
45
+ // $navbar-selector is used.
46
+ // - $navbar-width: The width of the navbar. Defaults to 100% of the container
47
+ // width.
48
+ // - $navbar-leading-gutter: An optional leading space between the navbar and
49
+ // and the container's inner edge. If specified, the $navbar-width must also
50
+ // be specified so that the width plus leading gutter plus padding isn't
51
+ // greater than 100% of the container's width.
52
+ // - $navbar-padding: An optional padding for the navbar. If specified, the
53
+ // $navbar-width must also be specified so that the width plus leading gutter
54
+ // plus padding isn't greater than 100% of the container's width.
55
+ //
56
+ @mixin zen-columns (
57
+ // Information about the columns.
58
+ $box-sizing: $zen-columns-box-sizing,
59
+ $selectors: ('.sidebar1', '.content', '.sidebar2'),
60
+ $widths: (),
61
+ $leading-direction: (),
62
+ $leading-gutters: (),
63
+ $padding: (),
64
+
65
+ // Information about the navbar.
66
+ $navbar-selector: false,
67
+ $navbar-height: 0,
68
+ $navbar-width: 100%,
69
+ $navbar-leading-gutter: 0,
70
+ $navbar-padding: 0
71
+ ) {
72
+
73
+ // Allow some parameters to be simple strings instead of lists.
74
+ @if type_of($widths) != list {
75
+ $widths: ($widths);
76
+ }
77
+ @if type_of($leading-direction) != list {
78
+ $leading-direction: ($leading-direction);
79
+ }
80
+ @if type_of($leading-gutters) != list {
81
+ $leading-gutters: ($leading-gutters);
82
+ }
83
+ @if type_of($padding) != list {
84
+ $padding: ($padding);
85
+ }
86
+ @if type_of($navbar-padding) != list {
87
+ $navbar-padding: ($navbar-padding);
88
+ }
89
+
90
+ // Declare all our variables so they can be used in any child block scope.
91
+ $col: 0;
92
+ $float: left;
93
+ @if length($leading-direction) > 0 {
94
+ $float: nth($leading-direction, 1);
95
+ }
96
+ $gutter: 0;
97
+ $left-fill: 0;
98
+ $left-reset: 0;
99
+ $right-fill: 0;
100
+ $right-reset: 0;
101
+ $margin: 0;
102
+ $padding-values: 0;
103
+ $padding-x: 0;
104
+ $navbar-padding-x: 0;
105
+ $navbar-padding-y: 0;
106
+ $navbar-reset: 0;
107
+ $navbar-true-height: 0;
108
+ $container-children: $selectors;
109
+
110
+ @if $navbar-selector {
111
+ // Determine the padding height and width of the navbar.
112
+ $navbar-padding-x: 2 * nth($navbar-padding, 1);
113
+ $navbar-padding-y: 2 * nth($navbar-padding, 1);
114
+ @if length($navbar-padding) == 4 {
115
+ $navbar-padding-x: nth($navbar-padding, 2) + nth($navbar-padding, 4);
116
+ }
117
+ @else if length($navbar-padding) >= 2 {
118
+ $navbar-padding-x: 2 * nth($navbar-padding, 2);
119
+ }
120
+ @if length($navbar-padding) >= 3 {
121
+ $navbar-padding-y: nth($navbar-padding, 1) + nth($navbar-padding, 3);
122
+ }
123
+ // We only keep track of the padding for content-box layouts.
124
+ @if $box-sizing == border-box {
125
+ $navbar-padding-x: 0;
126
+ }
127
+ // Determine the distance of the navbar's right edge from the container's left edge.
128
+ $navbar-reset: -$navbar-leading-gutter - $navbar-width - $navbar-padding-x;
129
+ // The columns need to know the true height of the navbar box.
130
+ $navbar-true-height: $navbar-height + $navbar-padding-y;
131
+ // Add the navbar to the list of the selectors of the container's children.
132
+ $container-children: append($container-children, $navbar-selector);
133
+ }
134
+
135
+ // #{} interpolation doesn't work when converting lists into selectors, so
136
+ // convert the list into an unquoted string before using it.
137
+ $string: false;
138
+ @each $child in $container-children {
139
+ @if $string == false {
140
+ $string: unquote($child);
141
+ }
142
+ @else {
143
+ $string: unquote($string + ', ' + $child);
144
+ }
145
+ }
146
+ $container-children: $string;
147
+
148
+ // Iterate over each column.
149
+ @each $column in $selectors {
150
+ // Number the columns.
151
+ $col: $col + 1;
152
+ // Find the width, floating direction and gutter of the current column.
153
+ $width: nth($widths, $col);
154
+ @if $col <= length($leading-direction) {
155
+ $float: nth($leading-direction, $col);
156
+ }
157
+ @if $col <= length($leading-gutters) {
158
+ $gutter: nth($leading-gutters, $col);
159
+ }
160
+ // Calculate the left/right padding as it affects the true width of the column.
161
+ @if $col <= length($padding) {
162
+ $padding-values: nth($padding, $col);
163
+ @if type_of($padding-values) != list {
164
+ $padding-values: ($padding-values);
165
+ }
166
+ $padding-x: 2 * nth($padding-values, 1);
167
+ @if length($padding-values) == 4 {
168
+ $padding-x: nth($padding-values, 2) + nth($padding-values, 4);
169
+ }
170
+ @else if length($padding-values) > 1 {
171
+ $padding-x: 2 * nth($padding-values, 2);
172
+ }
173
+ }
174
+ // We only keep track of the padding for content-box layouts.
175
+ @if $box-sizing == border-box {
176
+ $padding-x: 0;
177
+ }
178
+ // If the column is floating from the left, determine the distance from the
179
+ // container's left edge to the column's left edge ($left-fill) and to the
180
+ // column's right edge ($left-reset).
181
+ @if $float == left {
182
+ $left-fill: $left-fill + $gutter;
183
+ $left-reset: -$left-fill - $padding-x - $width;
184
+ $margin: $navbar-true-height $left-reset 0 $left-fill;
185
+ // The next column needs to know how much the previous columns have filled.
186
+ $left-fill: $left-fill + $width + $padding-x;
187
+ }
188
+ // If the column is floating from the right, determine the distance from the
189
+ // container's right edge to the column's right edge ($right-fill) and to
190
+ // the column's left edge ($right-reset).
191
+ @else {
192
+ $right-fill: $right-fill + $gutter;
193
+ $right-reset: -$right-fill - $padding-x - $width;
194
+ $margin: $navbar-true-height $right-fill 0 $right-reset;
195
+ // The next column needs to know how much the previous columns have filled.
196
+ $right-fill: $right-fill + $width + $padding-x;
197
+ }
198
+
199
+ // Apply rules to the columns.
200
+ #{$column} {
201
+ float: $float;
202
+ width: $width;
203
+ margin: $margin;
204
+ padding: $padding-values;
205
+ }
206
+ }
207
+
208
+ // Apply rules to the container.
209
+ position: relative;
210
+
211
+ // Apply rules to the navbar.
212
+ @if $navbar-selector {
213
+ #{$navbar-selector} {
214
+ float: $float;
215
+ height: $navbar-height;
216
+ margin: 0 $navbar-reset 0 $navbar-leading-gutter;
217
+ width: $navbar-width;
218
+ padding: $navbar-padding;
219
+ }
220
+ }
221
+
222
+ // Apply rules to navbar and columns.
223
+ #{$container-children} {
224
+ // Specify the border-box properties.
225
+ @if $box-sizing == border-box {
226
+ -moz-box-sizing: border-box;
227
+ -webkit-box-sizing: border-box;
228
+ -ms-box-sizing: border-box;
229
+ box-sizing: border-box;
230
+ }
231
+ // Prevent borders since they'll break the layout with content-box.
232
+ @if $box-sizing == content-box {
233
+ border: 0 !important;
234
+ }
235
+ // Prevent overflowing content from breaking the layout.
236
+ overflow: visible;
237
+ word-wrap: break-word; // A very nice CSS3 property.
238
+
239
+ @if $legacy-support-for-ie6 and $box-sizing == content-box {
240
+ .ie6 & {
241
+ display: inline; // display inline or double your floated margin! [1]
242
+ overflow: hidden; // in IE6, overflow auto is broken [2] and so is overflow visible [3]
243
+ overflow-y: visible;
244
+ }
245
+ }
246
+ }
247
+ }
248
+
249
+ // REFERENCES
250
+ //
251
+ // 1. http://www.positioniseverything.net/explorer/doubled-margin.html
252
+ // 2. http://browservulsel.blogspot.com/2005/04/ie-overflow-auto-scrollbar-overlap.html
253
+ // 3. http://www.howtocreate.co.uk/wrongWithIE/?chapter=overflow%3Avisible%3B
@@ -0,0 +1,155 @@
1
+ //
2
+ // Mixins for the Zen Grids system.
3
+ //
4
+
5
+
6
+ // Specify the number of columns in the grid.
7
+ $zen-column-count: 12 !default;
8
+
9
+ // Specify the width of the gutters; half of the gutter will be placed on each
10
+ // side of a grid column.
11
+ $zen-gutter-width: 20px !default;
12
+
13
+ // Specify the width of the entire grid. Defaults to 100% for a fluid responsive
14
+ // design, but you can change this to a pixel value if you need a fixed grid.
15
+ $zen-grid-width: 100% !default;
16
+
17
+ // Specify the default floating direction for zen's mixins.
18
+ $zen-float-direction: left !default;
19
+
20
+ // Specify the CSS3 box-sizing method. The default, "border-box", is compatible
21
+ // with all modern browsers, including IE 8 and later. Use "content-box" for
22
+ // wider compatibility (Note: you'll also need to set $legacy-support-for-ie7
23
+ // and $legacy-support-for-ie6 to true.)
24
+ $zen-box-sizing: border-box !default;
25
+
26
+ // This is a helper variable for RTL layouts.
27
+ $zen-reverse-all-floats: false !default;
28
+
29
+ // You can generate more efficient CSS if you manually apply the unit base to
30
+ // all grid elements in a single ruleset.
31
+ $zen-auto-include-unit-base: true !default;
32
+
33
+ // Turn off IE6/7 support since we're defaulting to box-sizing: border-box.
34
+ $legacy-support-for-ie7: false !default;
35
+ $legacy-support-for-ie6: false !default;
36
+
37
+
38
+ //
39
+ // Zen Grids requires the clearfix mixin.
40
+ //
41
+ @import "compass/utilities/general/clearfix";
42
+
43
+
44
+ //
45
+ // Apply this to the container element.
46
+ //
47
+ @mixin zen-grid-container () {
48
+ position: relative;
49
+ @include clearfix;
50
+ }
51
+
52
+ //
53
+ // Apply this to any content box that is also a container element for a nested
54
+ // grid.
55
+ //
56
+ @mixin zen-nested-container () {
57
+ @include zen-grid-container();
58
+ padding: {
59
+ left: 0;
60
+ right: 0;
61
+ }
62
+ }
63
+
64
+ //
65
+ // Apply this to each content box. Set the $column-position to the column number
66
+ // the content box starts on. And set the $column-span to the number of columns
67
+ // that the content box spans.
68
+ //
69
+ @mixin zen-grid (
70
+ $column-position,
71
+ $column-span,
72
+ $float-direction: $zen-float-direction,
73
+ $column-count: $zen-column-count,
74
+ $gutter-width: $zen-gutter-width,
75
+ $grid-width: $zen-grid-width,
76
+ $box-sizing: $zen-box-sizing
77
+ ) {
78
+
79
+ // Calculate the unit width.
80
+ $unit-width: $grid-width / $column-count;
81
+
82
+ // Determine the float direction and its reverse.
83
+ $dir: $float-direction;
84
+ @if $zen-reverse-all-floats {
85
+ $dir: zen-direction-flip($dir);
86
+ }
87
+ $rev: zen-direction-flip($dir);
88
+
89
+ // Auto-apply the unit base mixin.
90
+ @if $zen-auto-include-unit-base {
91
+ @include zen-grid-unit-base($box-sizing);
92
+ }
93
+
94
+ float: $dir;
95
+ width: $column-span * $unit-width;
96
+ margin: {
97
+ #{$dir}: ($column-position - 1) * $unit-width;
98
+ #{$rev}: (1 - $column-position - $column-span) * $unit-width;
99
+ }
100
+ padding: {
101
+ left: $gutter-width / 2;
102
+ right: $gutter-width / 2;
103
+ }
104
+ }
105
+
106
+ //
107
+ // Apply this mixin to each content box in the layout to prevent overflowing
108
+ // content from breaking the layout.
109
+ //
110
+ // The mixin has the following optional parameters:
111
+ // - $box-sizing: The type of CSS3 box model each box should use. Can be set to
112
+ // content-box or border-box. Defaults to content-box, but border-box is way
113
+ // cooler. IE 6 and 7 don't support border-box.
114
+ @mixin zen-grid-unit-base ($box-sizing: $zen-box-sizing) {
115
+ // Specify the border-box properties.
116
+ @if $box-sizing == border-box {
117
+ -moz-box-sizing: border-box;
118
+ -webkit-box-sizing: border-box;
119
+ -ms-box-sizing: border-box;
120
+ box-sizing: border-box;
121
+ }
122
+ // Prevent borders since they'll break the layout with content-box.
123
+ @if $box-sizing == content-box {
124
+ border: 0 !important;
125
+ }
126
+ // Prevent overflowing content from breaking the layout.
127
+ overflow: visible;
128
+ word-wrap: break-word; // A very nice CSS3 property.
129
+
130
+ @if $legacy-support-for-ie6 {
131
+ @if $box-sizing == content-box {
132
+ .ie6 & {
133
+ display: inline; // display inline or double your floated margin! [1]
134
+ overflow: hidden; // in IE6, overflow auto is broken [2] and so is overflow visible [3]
135
+ overflow-y: visible;
136
+ }
137
+ }
138
+ @else {
139
+ @warn "IE6 legacy support is on, but $box-sizing is set to #{$box-sizing}.";
140
+ }
141
+ }
142
+ }
143
+
144
+
145
+ //
146
+ // Helper functions for the Zen mixins.
147
+ //
148
+
149
+ // Returns the opposite direction, given "left" or "right".
150
+ @function zen-direction-flip($dir) {
151
+ @if $dir == left {
152
+ @return right;
153
+ }
154
+ @return left;
155
+ }
@@ -0,0 +1,57 @@
1
+ // Ideally, variables should be initialized in a partial. We're setting it here
2
+ // to make the mixin usage more transparent.
3
+ $gutter-width: 10px;
4
+
5
+
6
+ // Skip link styling
7
+ #skip-link {
8
+ margin: 0;
9
+
10
+ a,
11
+ a:visited {
12
+ display: block;
13
+ width: 100%;
14
+ padding: 2px 0 3px 0;
15
+ text-align: center;
16
+ background-color: #666;
17
+ color: #fff;
18
+ }
19
+ }
20
+
21
+ // Set a consistent padding around all containers
22
+ #header,
23
+ #content,
24
+ #main-menu,
25
+ #aside1,
26
+ #aside2,
27
+ #footer {
28
+ -moz-box-sizing: border-box;
29
+ -webkit-box-sizing: border-box;
30
+ -ms-box-sizing: border-box;
31
+ box-sizing: border-box;
32
+ padding: $gutter-width;
33
+ }
34
+
35
+ // Alternate border styling
36
+ #header,
37
+ #main-menu,
38
+ #aside2 {
39
+ border: 1px solid #ccc;
40
+ }
41
+ #content,
42
+ #aside1,
43
+ #footer {
44
+ border: 1px solid #09f;
45
+ }
46
+
47
+ // Source-order meta info
48
+ header h1,
49
+ header h2 {
50
+ display: inline;
51
+ }
52
+ header p {
53
+ display: inline;
54
+ text-transform: uppercase;
55
+ font-size: 0.8em;
56
+ color: #c00;
57
+ }
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Zen Grids: sample usage</title>
6
+ <link rel="stylesheet" href="stylesheets/styles.css" media="all">
7
+ </head>
8
+ <body>
9
+
10
+ <p id="skip-link">
11
+ <a href="#main-menu">Jump to main menu</a>
12
+ </p>
13
+
14
+ <header id="header">
15
+ <h1>Zen Grids: sample usage</h1>
16
+ </header>
17
+
18
+ <div id="main">
19
+
20
+ <article id="content" role="main">
21
+ <header>
22
+ <h1>Main content</h1>
23
+ <p>Source order: 1</p>
24
+ </header>
25
+ <p>Alice did not quite know what to say to this: so she helped herself to some tea and bread-and-butter, and then turned to the Dormouse, and repeated her question. ‘Why did they live at the bottom of a well?’</p>
26
+ <p>The Dormouse again took a minute or two to think about it, and then said, ‘It was a treacle-well.’</p>
27
+ <p>‘There’s no such thing!’ Alice was beginning very angrily, but the Hatter and the March Hare went ‘Sh! sh!’ and the Dormouse sulkily remarked, ‘If you can’t be civil, you’d better finish the story for yourself.’</p>
28
+ <p>‘No, please go on!’ Alice said very humbly; ‘I won’t interrupt again. I dare say there may be ONE.’</p>
29
+ </article>
30
+
31
+ <nav id="main-menu" role="navigation">
32
+ <header>
33
+ <h2>Menu</h2>
34
+ <p>Source order: 2</p>
35
+ </header>
36
+ <a href="#">Alice</a> ★
37
+ <a href="#">Mad Hatter</a> ★
38
+ <a href="#">The Queen</a> ★
39
+ <a href="#">Tom Petty</a>
40
+ </nav>
41
+
42
+ <aside id="aside1">
43
+ <header>
44
+ <h2>Aside</h2>
45
+ <p>Source order: 3</p>
46
+ </header>
47
+ <p>‘Have some wine,’ the March Hare said in an encouraging tone.</p>
48
+ </aside>
49
+
50
+ <aside id="aside2">
51
+ <header>
52
+ <h2>Aside</h2>
53
+ <p>Source order: 4</p>
54
+ </header>
55
+ <p>‘Please would you tell me,’ said Alice, a little timidly, for she was not quite sure whether it was good manners for her to speak first, ‘why your cat grins like that?’</p>
56
+ <p>‘It’s a Cheshire cat,’ said the Duchess, ‘and that’s why. Pig!’</p>
57
+ </aside>
58
+
59
+ </div>
60
+
61
+ <footer id="footer">
62
+ <small>© 2012. The small print.</small>
63
+ </footer>
64
+
65
+ </body>
66
+ </html>
@@ -0,0 +1,86 @@
1
+ // Ideally, variables should be initialized in a partial. We're setting
2
+ // variables here to make the mixin usage more transparent.
3
+ $legacy-support-for-ie6: false;
4
+ $legacy-support-for-ie7: false;
5
+
6
+ // Import Zen Grids.
7
+ @import "zen";
8
+
9
+ $zen-column-count: 12;
10
+ $zen-gutter-width: 20px;
11
+
12
+ $navbar-height: 4em;
13
+
14
+ //
15
+ // Skip link styling
16
+ //
17
+ @media all and (min-width: 480px) {
18
+ #skip-link a {
19
+ position: absolute !important;
20
+ height: 1px;
21
+ width: 1px;
22
+ overflow: hidden;
23
+ @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
24
+ clip: rect(1px 1px 1px 1px); // IE6 and IE7 use the wrong syntax.
25
+ }
26
+ clip: rect(1px, 1px, 1px, 1px);
27
+
28
+ &:active,
29
+ &:focus {
30
+ position: static !important;
31
+ clip: auto;
32
+ height: auto;
33
+ width: auto;
34
+ overflow: auto;
35
+ }
36
+ }
37
+ }
38
+
39
+ #main {
40
+ @include zen-grid-container();
41
+ }
42
+
43
+ @media all and (min-width: 480px) and (max-width: 639px) {
44
+ $zen-column-count: 3;
45
+
46
+ #main {
47
+ padding-top: $navbar-height;
48
+ }
49
+ #main-menu {
50
+ @include zen-grid(1, 3);
51
+ margin-top: -$navbar-height;
52
+ height: $navbar-height;
53
+ }
54
+ #content {
55
+ @include zen-grid(1, 2);
56
+ }
57
+ #aside1 {
58
+ @include zen-grid(1, 1, right);
59
+ }
60
+ #aside2 {
61
+ clear: right;
62
+ @include zen-grid(1, 1, right);
63
+ }
64
+ }
65
+
66
+ @media all and (min-width: 640px) {
67
+ $zen-column-count: 5;
68
+
69
+ #main {
70
+ padding-top: $navbar-height;
71
+ }
72
+ #main-menu {
73
+ @include zen-grid(1, 5);
74
+ margin-top: -$navbar-height;
75
+ height: $navbar-height;
76
+ }
77
+ #content {
78
+ @include zen-grid(2, 3);
79
+ }
80
+ #aside1 {
81
+ @include zen-grid(1, 1);
82
+ }
83
+ #aside2 {
84
+ @include zen-grid(5, 1);
85
+ }
86
+ }
@@ -0,0 +1,25 @@
1
+ description "The Zen Grids system."
2
+
3
+ stylesheet 'common.scss', :media => 'all'
4
+ stylesheet 'layout.scss', :media => 'all'
5
+ stylesheet 'styles.scss', :media => 'all'
6
+
7
+ html 'example.html'
8
+
9
+ help %Q{
10
+ The Zen Grids system is an easy-to-use responsive grid system. It's immune to
11
+ browser rounding errors and its source order is mostly independent from display
12
+ order. To learn more, visit:
13
+
14
+ http://zengrids.com
15
+ }
16
+
17
+ welcome_message %Q{
18
+ You rock! The Zen Grids system is now installed on your computer. Go check out
19
+ how to use the system at:
20
+
21
+ http://zengrids.com
22
+
23
+ It's easy! And (bonus!) you'll find pre-made responsive layouts you can
24
+ customize and start using on your website today.
25
+ }
@@ -0,0 +1,3 @@
1
+ // Aggregate all the stylesheets into one file.
2
+ @import "common.scss";
3
+ @import "layout.scss";
data/zen-grids.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'zen-grids'
5
+
6
+ s.summary = %q{A Compass plugin for Zen Grids, a fluid responsive grid system}
7
+ s.description = %q{The Zen Grids system is a fluid responsive grid system that is immune to rounding errors and overflowing content. With an easy-to-use Sass mixin set, the Zen Grids system can be applied to an infinite number of layouts.}
8
+
9
+ s.homepage = 'http://zengrids.com'
10
+ s.rubyforge_project =
11
+
12
+ s.version = '1.0.alpha.1'
13
+ s.date = '2012-01-11'
14
+
15
+ s.authors = ['John Albin Wilkins']
16
+ s.email = 'virtually.johnalbin@gmail.com'
17
+
18
+ s.add_runtime_dependency('sass', ">= 3.1")
19
+
20
+ s.files = %w[
21
+ LICENSE.txt
22
+ README.txt
23
+ lib/zen-grids.rb
24
+ stylesheets/_zen.scss
25
+ stylesheets/zen/_columns.scss
26
+ stylesheets/zen/_grids.scss
27
+ templates/project/example.html
28
+ templates/project/manifest.rb
29
+ templates/project/common.scss
30
+ templates/project/layout.scss
31
+ templates/project/styles.scss
32
+ zen-grids.gemspec
33
+ ]
34
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zen-grids
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: true
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - alpha
9
+ - 1
10
+ version: 1.0.alpha.1
11
+ platform: ruby
12
+ authors:
13
+ - John Albin Wilkins
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-01-11 00:00:00 +08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: sass
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 3
30
+ - 1
31
+ version: "3.1"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: The Zen Grids system is a fluid responsive grid system that is immune to rounding errors and overflowing content. With an easy-to-use Sass mixin set, the Zen Grids system can be applied to an infinite number of layouts.
35
+ email: virtually.johnalbin@gmail.com
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files: []
41
+
42
+ files:
43
+ - LICENSE.txt
44
+ - README.txt
45
+ - lib/zen-grids.rb
46
+ - stylesheets/_zen.scss
47
+ - stylesheets/zen/_columns.scss
48
+ - stylesheets/zen/_grids.scss
49
+ - templates/project/example.html
50
+ - templates/project/manifest.rb
51
+ - templates/project/common.scss
52
+ - templates/project/layout.scss
53
+ - templates/project/styles.scss
54
+ - zen-grids.gemspec
55
+ has_rdoc: true
56
+ homepage: http://zengrids.com
57
+ licenses: []
58
+
59
+ post_install_message:
60
+ rdoc_options: []
61
+
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">"
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 1
77
+ - 3
78
+ - 1
79
+ version: 1.3.1
80
+ requirements: []
81
+
82
+ rubyforge_project: 1.0.alpha.1
83
+ rubygems_version: 1.3.6
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: A Compass plugin for Zen Grids, a fluid responsive grid system
87
+ test_files: []
88
+