ericam-compass-susy-plugin 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mkdn +81 -80
- data/VERSION +1 -1
- data/compass-susy-plugin.gemspec +2 -2
- data/docs/tutorial/figures/susy_element.png +0 -0
- data/docs/tutorial/figures/susy_grid.png +0 -0
- data/docs/tutorial/index.mkdn +336 -0
- data/sass/susy/_grid.sass +37 -5
- data/sass/susy/_utils.sass +33 -32
- data/templates/project/_base.sass +0 -6
- data/templates/project/ie.sass +2 -0
- data/templates/project/print.sass +8 -2
- data/templates/project/screen.sass +36 -8
- metadata +4 -1
data/README.mkdn
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Susy - Compass Plugin
|
2
|
-
|
2
|
+
=====================
|
3
3
|
|
4
4
|
Susy is a semantic CSS framework creator entirely native to
|
5
5
|
[Compass](http://compass-style.org/).
|
@@ -23,101 +23,101 @@ Install
|
|
23
23
|
sudo gem install ericam-compass-susy-plugin
|
24
24
|
|
25
25
|
Create a Susy-based Compass Project
|
26
|
-
|
26
|
+
===================================
|
27
27
|
|
28
28
|
compass -r susy -f susy <project name>
|
29
29
|
|
30
30
|
Then edit your `_base.sass`, `screen.sass` and `print.sass` files accordingly.
|
31
31
|
A reset is added automatically.
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
Philosophy and Goals
|
34
|
+
--------------------
|
35
35
|
|
36
|
-
|
36
|
+
The method comes from [Natalie Downe](http://natbat.net/)'s "[CSS
|
37
|
+
Systems](http://natbat.net/2008/Sep/28/css-systems/)", but I'll cover it here.
|
37
38
|
|
38
|
-
|
39
|
-
in), `!total_cols` (total number of columns in your grid), `!col_width` (width
|
40
|
-
of columns), and `!gutter_width` (width of gutters) variables in your
|
41
|
-
`_base.sass`.
|
39
|
+
It is important for accessibility and usability that we are:
|
42
40
|
|
43
|
-
|
41
|
+
* Responsive to text sizing: In order for our site to be accessible we need to
|
42
|
+
allow different font-sizes to be set by the client. In order to maintain
|
43
|
+
design integrity of proportions and line-lengths, the grid needs to respond
|
44
|
+
to those sizes.
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
* Responsive to window sizing: In order to maintain usability across
|
47
|
+
platforms/monitors, our grid needs to respond to the size of the viewport.
|
48
|
+
This is mainly an issue as the viewport shrinks and we are given a
|
49
|
+
side-scroll bar. No one likes that. On the large end our design integrity
|
50
|
+
and line lengths are more important than taking up all the possible space.
|
50
51
|
|
51
|
-
|
52
|
-
|
52
|
+
In order to achieve both we need to combine the best of the elastic (em-based)
|
53
|
+
and fluid (%-based) models. The solution is simple: First we build a fluid
|
54
|
+
grid, then place it inside an elastic shell, and apply a maximum width to that
|
55
|
+
shell so that it never exceeds the size of the viewport. It's simple in
|
56
|
+
theory, but daunting in practice, as you constantly have to adjust your math
|
57
|
+
based on the context.
|
53
58
|
|
54
|
-
|
55
|
-
this all meaningful. Do that by assigning a pixel value (without the units) to
|
56
|
-
`!base_font_size_px` and `!base_line_height_px`. Susy will convert those to a
|
57
|
-
percentage of the common browser default (16px) and apply them to your
|
58
|
-
`grid-container`.
|
59
|
+
But Susy harnesses the power of Compass and Sass to do all the math for you.
|
59
60
|
|
60
|
-
|
61
|
+
Grid Basics
|
62
|
+
===========
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
+
* Set up your default grid values (total columns, column width, gutter
|
65
|
+
width, side gutter width), your base font size, and other style defaults
|
66
|
+
in `_base.sass`.
|
64
67
|
|
65
|
-
|
68
|
+
* Create your grid in `screen.sass`: apply the `+susy` mixin to the `body`
|
69
|
+
element and the `+container` mixin to the element that contains the page
|
70
|
+
grid.
|
66
71
|
|
67
|
-
`
|
68
|
-
colors to reuse throughout, and default styles for all those elements that
|
69
|
-
ought have a default (but don't because of the reset).
|
72
|
+
* Use the `+columns` mixin to declare the width in columns of an element,
|
70
73
|
|
71
|
-
|
72
|
-
|
74
|
+
* Use `+alpha` and `+omega` to declare elements which include the first or
|
75
|
+
last column within their parent element (`+full` to declare both `+alpha`
|
76
|
+
and `+omega`).
|
73
77
|
|
74
|
-
* Use
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
* Use the `+container` mixin to declare your container
|
79
|
-
element. Besides building the grid shell, this sets your horizontal
|
80
|
-
margins to auto (for centered designs) and returns your
|
81
|
-
text-alignment to "left". Change the internal text alignment with an
|
82
|
-
optional `left | center | right` argument.
|
83
|
-
|
84
|
-
* Use the `+columns` mixin to set the width (in columns) of a grid element.
|
85
|
-
The first argument is the number of columns to span, the second (optional)
|
86
|
-
argument is the width (in columns) of the containing element when nesting
|
87
|
-
(defaults to the container's `!total_cols`). By default, the left margin
|
88
|
-
is set to 0 and the right margin is set to the width of a gutter. Modify
|
89
|
-
this for first and last elements with the `+alpha` and `+omega` mixins
|
90
|
-
(below), or set larger margins using `+prefix` and `+suffix`.
|
91
|
-
|
92
|
-
* Use the `+alpha` and `+omega` mixins to declare the first and last
|
93
|
-
elements in a row, or inside a nested element. In the latter case, each of
|
94
|
-
these mixins takes one argument, which is the size (in columns) of the
|
95
|
-
containing element.
|
96
|
-
|
97
|
-
* Use the `+prefix` and `+suffix` mixins with one argument to add that
|
98
|
-
many grid columns as margin before or after a grid element. These
|
99
|
-
mixins also take an optional second argument, the size in columns of
|
100
|
-
the containing element when nested.
|
101
|
-
|
102
|
-
Example:
|
103
|
-
|
104
|
-
body
|
105
|
-
+susy
|
78
|
+
* Use `+prefix` or `+suffix` to give the width (in columns) of an elements
|
79
|
+
left or right margin, or `+pad` to give both `+prefix` and `+suffix` at
|
80
|
+
once.
|
106
81
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
82
|
+
* In nested contexts, all of these mixins take an extra final argument, the
|
83
|
+
width in columns of the parent (nesting) element.
|
84
|
+
|
85
|
+
* That's it for the basics! Here's a sample Susy grid layout:
|
86
|
+
|
87
|
+
body
|
88
|
+
+susy
|
89
|
+
|
90
|
+
#page
|
91
|
+
+container
|
92
|
+
|
93
|
+
#brand
|
94
|
+
+columns(8)
|
95
|
+
+pad(1,1)
|
96
|
+
+full
|
97
|
+
h1
|
98
|
+
+columns(5,8)
|
99
|
+
+pad(1,2,8)
|
100
|
+
+full(8)
|
101
|
+
|
102
|
+
#nav
|
103
|
+
+columns(2)
|
104
|
+
+alpha
|
105
|
+
|
106
|
+
#content
|
107
|
+
+columns(8)
|
108
|
+
+omega
|
109
|
+
#description
|
110
|
+
+columns(5,8)
|
111
|
+
+alpha(8)
|
112
|
+
#credit
|
113
|
+
+columns(3,8)
|
114
|
+
+omega(8)
|
115
|
+
|
116
|
+
Tutorial
|
117
|
+
========
|
118
|
+
|
119
|
+
For more details, read [the tutorial](http://www.oddbird.net/susy/tutorial/).
|
120
|
+
It's also included with Susy in the docs/ folder.
|
121
121
|
|
122
122
|
Extra Utility Mixins
|
123
123
|
=====================
|
@@ -143,13 +143,14 @@ options, experimental (CSS3/proprietary) CSS, and more.
|
|
143
143
|
|
144
144
|
And then the fun stuff:
|
145
145
|
|
146
|
-
* `+opacity(!opacity)` adds cross-browser opacity settings (takes a range of
|
147
|
-
|
146
|
+
* `+opacity(!opacity)` adds cross-browser opacity settings (takes a range of
|
147
|
+
0 to 1).
|
148
148
|
|
149
149
|
* `+border-radius(!radius)` (`+border-bottom-left-radius` etc. all work) for
|
150
150
|
rounded corners in supporting browsers.
|
151
151
|
|
152
|
-
* `+box-sizing(!model)` for setting the box sizing model in supporting
|
152
|
+
* `+box-sizing(!model)` for setting the box sizing model in supporting
|
153
|
+
browsers.
|
153
154
|
|
154
155
|
* `+box-shadow(!verticaloffset, !horizontaloffset, !blur, !color)` for
|
155
156
|
box-shadow in webkit and CSS3.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/compass-susy-plugin.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{compass-susy-plugin}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.4.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Eric Meyer"]
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = %q{Susy is a ground-up native Compass plugin grid system that takes full advantage of Sass' capabilities to remove the tedium from grid-based web design.}
|
11
11
|
s.email = %q{eric@oddbird.net}
|
12
12
|
s.extra_rdoc_files = ["lib/susy/compass_plugin.rb", "lib/susy/sass_extensions.rb", "lib/susy.rb", "README.mkdn"]
|
13
|
-
s.files = ["lib/susy/compass_plugin.rb", "lib/susy/sass_extensions.rb", "lib/susy.rb", "Manifest", "Rakefile", "README.mkdn", "sass/susy/_grid.sass", "sass/susy/_utils.sass", "sass/susy/_text.sass", "sass/susy/_susy.sass", "templates/project/_base.sass", "templates/project/screen.sass", "templates/project/print.sass", "templates/project/ie.sass", "templates/project/manifest.rb", "VERSION", "LICENSE.txt", "compass-susy-plugin.gemspec"]
|
13
|
+
s.files = ["lib/susy/compass_plugin.rb", "lib/susy/sass_extensions.rb", "lib/susy.rb", "Manifest", "Rakefile", "README.mkdn", "sass/susy/_grid.sass", "sass/susy/_utils.sass", "sass/susy/_text.sass", "sass/susy/_susy.sass", "templates/project/_base.sass", "templates/project/screen.sass", "templates/project/print.sass", "templates/project/ie.sass", "templates/project/manifest.rb", "VERSION", "LICENSE.txt", "docs/tutorial/index.mkdn", "docs/tutorial/figures/susy_element.png", "docs/tutorial/figures/susy_grid.png", "compass-susy-plugin.gemspec"]
|
14
14
|
s.homepage = %q{http://github.com/ericam/compass-susy-plugin}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Compass-Susy-plugin", "--main", "README.mkdn"]
|
16
16
|
s.require_paths = ["lib"]
|
Binary file
|
Binary file
|
@@ -0,0 +1,336 @@
|
|
1
|
+
Susy Tutorial
|
2
|
+
=============
|
3
|
+
|
4
|
+
Once you've [installed
|
5
|
+
everything](http://github.com/ericam/compass-susy-plugin/tree/master) we can
|
6
|
+
start building our grid. I'll walk you through the steps. I'm starting with
|
7
|
+
the assumption that you already know CSS and the Compass/Sass syntax. If you
|
8
|
+
don't, check out [Chris Eppstein's great
|
9
|
+
intro](http://wiki.github.com/chriseppstein/compass).
|
10
|
+
|
11
|
+
For a brief overview of Susy's philosophy and goals, see [the
|
12
|
+
README](http://github.com/ericam/compass-susy-plugin/tree/master#readme).
|
13
|
+
|
14
|
+
On Susy's Terms
|
15
|
+
---------------
|
16
|
+
|
17
|
+
Here are the terms to understand for following along and using Susy:
|
18
|
+
|
19
|
+
* There is always a **container** element that wraps the page. This container
|
20
|
+
will act as our elastic shell. The **container** also represents a grid
|
21
|
+
structure made up of **columns**, **gutters** between the columns, and
|
22
|
+
**side gutters** on the outside edges of the grid.
|
23
|
+
|
24
|
+
[![The Susy Grid](figures/susy_grid.png)](figures/susy_grid.png)
|
25
|
+
|
26
|
+
* The base **context** is the number of columns in your grid system, and any
|
27
|
+
direct children of the **container** will use that base as their
|
28
|
+
**context**. However, as you continue to nest elements within each other
|
29
|
+
that context will change. Just remember that the **context** is always the
|
30
|
+
number of columns spanned by the parent element.
|
31
|
+
|
32
|
+
* There are any number of **grid elements** making up the structure of our
|
33
|
+
site, nested within the **container**. Each grid element has a width that
|
34
|
+
spans any number of **columns** along with the **gutters** between those
|
35
|
+
columns (number of columns minus one), and a right-margin that represents
|
36
|
+
the gutter to the right of it.
|
37
|
+
|
38
|
+
[![The Susy Grid Element](figures/susy_element.png)](figures/susy_element.png)
|
39
|
+
|
40
|
+
* A **grid element** might also include a **prefix** and/or **suffix** added
|
41
|
+
as padding on either side. Any **prefix** or **suffix** will span the number
|
42
|
+
of **columns** given as argument, as well as all associated **gutters** (in
|
43
|
+
this case the same number of gutters as columns).
|
44
|
+
|
45
|
+
* Any **grid elements** that span the first or last columns in any given
|
46
|
+
context will sometimes need to handle gutters in special ways. These will be
|
47
|
+
referred to as the **alpha** and **omega** elements. One element that spans
|
48
|
+
an entire context (a header or footer perhaps) may be both **alpha** and
|
49
|
+
**omega**.
|
50
|
+
|
51
|
+
Customizing your Grid System
|
52
|
+
----------------------------
|
53
|
+
|
54
|
+
So let's get started. We're going to build a website for Susy. [This
|
55
|
+
website](http://www.oddbird.net/susy/). It's a simple site but it covers
|
56
|
+
everything you need to get started on your own.
|
57
|
+
|
58
|
+
Create yourself a Compass project using Susy:
|
59
|
+
|
60
|
+
compass -r susy -f susy susy_tutorial
|
61
|
+
|
62
|
+
Inside the susy_tutorial directory, create an `index.html` file. You can [grab
|
63
|
+
my source](01_target/index.html).
|
64
|
+
|
65
|
+
Start in your `_base.sass` file (in the `src` directory). That's where you set
|
66
|
+
all your defaults.
|
67
|
+
|
68
|
+
To create a grid, set the `!grid_unit` (units that your grid is based in),
|
69
|
+
`!total_cols` (total number of columns in your grid), `!col_width` (width of
|
70
|
+
columns), and `!gutter_width` (width of gutters) variables.
|
71
|
+
|
72
|
+
The default values are 16 columns, 4em column widths, 1em gutters and side
|
73
|
+
gutters that match the internal ones. But we want a 10 column grid, with 5em
|
74
|
+
columns, 2em gutters and 1em side-gutters.
|
75
|
+
|
76
|
+
Take a look at our target site again, this time [with a grid
|
77
|
+
overlay](01_target/).
|
78
|
+
|
79
|
+
So we'll set our grid like this:
|
80
|
+
|
81
|
+
!grid_unit = "em"
|
82
|
+
!total_cols = 10
|
83
|
+
!col_width = 5
|
84
|
+
!gutter_width = 2
|
85
|
+
!side_gutter_width = 1
|
86
|
+
|
87
|
+
Of course, designing in em's, we'll want to get your font sizes set to make
|
88
|
+
this all meaningful. Do that by assigning a pixel value (without the units) to
|
89
|
+
`!base_font_size_px` and `!base_line_height_px`. Susy will convert those to a
|
90
|
+
percentage of the common browser default (16px) and apply them to your grid.
|
91
|
+
|
92
|
+
The default values here are 12px fonts with an 18px line-height. For us:
|
93
|
+
|
94
|
+
!base_font_size_px = 14
|
95
|
+
!base_line_height_px = 21
|
96
|
+
|
97
|
+
`_base.sass` also has everything you need for setting default font families,
|
98
|
+
colors to reuse throughout, and default styles for all those elements that
|
99
|
+
ought have a default (but don't because of the reset).
|
100
|
+
|
101
|
+
We can leave most of that as it is for now, but let's fill in a few of the
|
102
|
+
most important defaults. We want some colors to choose from, and defaults for
|
103
|
+
links and paragraphs.
|
104
|
+
|
105
|
+
So let's add some colors:
|
106
|
+
|
107
|
+
!text = #332016
|
108
|
+
!light = #CC8866
|
109
|
+
!links = #4CAAC0
|
110
|
+
|
111
|
+
And style the links:
|
112
|
+
|
113
|
+
a
|
114
|
+
&:link, &:visited
|
115
|
+
:color= !links
|
116
|
+
:text-decoration none
|
117
|
+
&:focus, &:hover, &:active
|
118
|
+
:color= !light
|
119
|
+
:border-bottom
|
120
|
+
:width .1429em
|
121
|
+
:style dashed
|
122
|
+
|
123
|
+
(`.1429em` is just an approximation of `2px` in terms of our em units.)
|
124
|
+
|
125
|
+
And we'll add a bit of margin to our paragraphs:
|
126
|
+
|
127
|
+
p
|
128
|
+
:margin-bottom 1.5em
|
129
|
+
|
130
|
+
That's it. You can look around at the other defaults and set what you like, or
|
131
|
+
juse use [mine](../src/_base.sass).
|
132
|
+
|
133
|
+
|
134
|
+
Making Semantic Grids
|
135
|
+
---------------------
|
136
|
+
|
137
|
+
First the explanation:
|
138
|
+
|
139
|
+
* Use the `+susy` mixin to get things ready, set your base font sizes and
|
140
|
+
center your grid in the browser window. Change the alignment of your grid in
|
141
|
+
the window with an optional `left | center | right` argument.
|
142
|
+
|
143
|
+
* Use the `+container` mixin to declare your container element. Besides
|
144
|
+
building the grid shell, this sets your horizontal margins to auto (for
|
145
|
+
centered designs) and returns your text-alignment to "left". Change the
|
146
|
+
internal text alignment with an optional `left | center | right` argument.
|
147
|
+
|
148
|
+
* Use the `+columns` mixin to set the width (in columns) of a grid element.
|
149
|
+
The first argument is the number of columns to span, the second (optional)
|
150
|
+
argument is the width (in columns) of the containing element when
|
151
|
+
nesting. If the element is not nested (its parent is the grid container),
|
152
|
+
don't pass a second argument.
|
153
|
+
|
154
|
+
* Use the `+alpha` and `+omega` mixins to declare the first and last elements
|
155
|
+
in a row, or inside a nested element. In the latter case, each of these
|
156
|
+
mixins takes one argument, which is the size (in columns) of the containing
|
157
|
+
element.
|
158
|
+
|
159
|
+
* Use the `+prefix` and `+suffix` mixins with one argument to add that many
|
160
|
+
grid columns as padding before or after a grid element. These mixins also
|
161
|
+
take an optional second argument, the size in columns of the containing
|
162
|
+
element when nested.
|
163
|
+
|
164
|
+
Then we do it. In `screen.sass`, we'll start by declaring our intent to use
|
165
|
+
Susy, and our container:
|
166
|
+
|
167
|
+
body
|
168
|
+
+susy
|
169
|
+
|
170
|
+
#page
|
171
|
+
+container
|
172
|
+
|
173
|
+
That wasn't hard. You might ask why I didn't nest `#page` inside of `body`, as
|
174
|
+
is so tempting and easy with Sass. It's part personal preference and part
|
175
|
+
Natalie Downe's voice in my head. Don't nest when you don't need to. It keeps
|
176
|
+
your output code much cleaner.
|
177
|
+
|
178
|
+
While we're at it, why don't we get the fonts and text colors going right from
|
179
|
+
the start?
|
180
|
+
|
181
|
+
#page
|
182
|
+
+container
|
183
|
+
+sans-family
|
184
|
+
:color= !text
|
185
|
+
|
186
|
+
Perfect. Take a look at [the results](02_container/). So far we have:
|
187
|
+
|
188
|
+
* Reset everything. This happens by default in the background.
|
189
|
+
|
190
|
+
* Added a few of our own replacement default styles, like links, paragraphs,
|
191
|
+
fonts and colors.
|
192
|
+
|
193
|
+
* Created an elastic container for our grid at 70em that goes fluid for small
|
194
|
+
windows (try it!).
|
195
|
+
|
196
|
+
|
197
|
+
Laying Out The Components
|
198
|
+
--------------------------
|
199
|
+
|
200
|
+
It's time to lay out our grid components. We'll just work our way through the
|
201
|
+
DOM, starting with our brand header (#brand). We can refer back to our [target
|
202
|
+
site with a grid overlay](01_target/) to see what we need. Looks like our
|
203
|
+
branding gets an entire row to itself, with the content starting one row
|
204
|
+
in. For the sake of argument, let's say we want the header content contained
|
205
|
+
within the middle 8 columns - one in from each end. That means it will be an 8
|
206
|
+
column element, with 1 column prefixed and one suffixed, for a total of 10
|
207
|
+
columns - the full width.
|
208
|
+
|
209
|
+
#brand
|
210
|
+
+columns(8)
|
211
|
+
+prefix(1)
|
212
|
+
+suffix(1)
|
213
|
+
|
214
|
+
Since it spans both the first and last columns in the context we'll need to
|
215
|
+
add:
|
216
|
+
|
217
|
+
+alpha
|
218
|
+
+omega
|
219
|
+
|
220
|
+
Or we would have to, but there are several shortcuts available to us. To
|
221
|
+
declare something as both alpha and omega we can just declare it as full:
|
222
|
+
|
223
|
+
+full
|
224
|
+
|
225
|
+
There is also a shorcut for prefix and suffix additions (+pad), so we can
|
226
|
+
simplify down to:
|
227
|
+
|
228
|
+
#brand
|
229
|
+
+columns(8)
|
230
|
+
+pad(1,1)
|
231
|
+
+full
|
232
|
+
|
233
|
+
Since we don't have an image in there yet, let's move the text over to line up
|
234
|
+
with the future placement of our main content area. By turning the `h1` link
|
235
|
+
into a grid element and prefixing a padding of one column, we can move the
|
236
|
+
text without any effect on the image that will replace it (using the Compass
|
237
|
+
utility `+replace-text`, though I'll leave the implementation that as an
|
238
|
+
exercise for you to figure out). To line it all up with the content below it,
|
239
|
+
we'll assign it 5 columns in a context of 8, with the extra 3 split between a
|
240
|
+
prefix of 1 and a suffix of 2 - giving it a full span.
|
241
|
+
|
242
|
+
h1 a
|
243
|
+
+columns(5,8)
|
244
|
+
+pad(1,2,8)
|
245
|
+
+full(8)
|
246
|
+
|
247
|
+
There is one 'gotcha' in the way Susy handles context. Direct children of your
|
248
|
+
container (such as #brand in this case) *must not declare a context*. If you
|
249
|
+
do, your side-gutters will be ignored. At every nested layer below that, even
|
250
|
+
if the context hasn't changed, you *must declare a context* or it will try to
|
251
|
+
add side-gutters again. That means even if you have one nested element
|
252
|
+
wrapping the rest at full width and not changing the context, that wrapper
|
253
|
+
does not get a context but its descendants do, even where that context is the
|
254
|
+
same as the full page.
|
255
|
+
|
256
|
+
For example, these *will not work*:
|
257
|
+
|
258
|
+
#page
|
259
|
+
+container
|
260
|
+
.inner
|
261
|
+
+columns(10,10)
|
262
|
+
|
263
|
+
#page
|
264
|
+
+container
|
265
|
+
.inner
|
266
|
+
+columns(10)
|
267
|
+
#brand
|
268
|
+
+columns(10)
|
269
|
+
|
270
|
+
This *will work*:
|
271
|
+
|
272
|
+
#page
|
273
|
+
+container
|
274
|
+
.inner
|
275
|
+
+columns(10)
|
276
|
+
#brand
|
277
|
+
+columns(10,10)
|
278
|
+
|
279
|
+
Remember that if your side gutters or columns ever seem the wrong size.
|
280
|
+
|
281
|
+
We're only worried about structure for now, so the header is done. Let's move
|
282
|
+
on to the navigation (#nav). The nav spans 2 columns, including the first
|
283
|
+
column in it's context.
|
284
|
+
|
285
|
+
#nav
|
286
|
+
+columns(2)
|
287
|
+
+alpha
|
288
|
+
|
289
|
+
Done. The content (#content, which includes both #description and #credit)
|
290
|
+
spans the remaining 8 columns, including the last one.
|
291
|
+
|
292
|
+
#content
|
293
|
+
+columns(8)
|
294
|
+
+omega
|
295
|
+
|
296
|
+
Done. #description spans 5, including the first; #credit spans 3 including
|
297
|
+
the last. Both are in a nested context of 8, which we now need to pass on:
|
298
|
+
|
299
|
+
#description
|
300
|
+
+columns(5,8)
|
301
|
+
+alpha(8)
|
302
|
+
|
303
|
+
#credit
|
304
|
+
+columns(3,8)
|
305
|
+
+omega(8)
|
306
|
+
|
307
|
+
Done and done. All we have left is the footer (#site-info) spanning the full
|
308
|
+
width, but only using the right 8 columns:
|
309
|
+
|
310
|
+
#site-info
|
311
|
+
+columns(8)
|
312
|
+
+prefix(2)
|
313
|
+
+full
|
314
|
+
|
315
|
+
Nested in the footer are `.license` and `.styles`, so let's put them in
|
316
|
+
place. I'm going to say that each should match the width of the element
|
317
|
+
visually above it on the page. So .license will span 5 columns including the
|
318
|
+
first in its context of 8, and .styles will span 3 including the last.
|
319
|
+
|
320
|
+
p.license
|
321
|
+
+columns(5,8)
|
322
|
+
+alpha(8)
|
323
|
+
p.styles
|
324
|
+
+columns(3,8)
|
325
|
+
+omega(8)
|
326
|
+
|
327
|
+
And we're done. That's it. That's what Susy does. The details of making it
|
328
|
+
pretty are left as an exercise for the reader, and have more to do with
|
329
|
+
Compass than Susy.
|
330
|
+
|
331
|
+
* [The resulting files](03_structure/src/) with [the site structure all in
|
332
|
+
place](03_structure/) (this should match what you have if you followed
|
333
|
+
along).
|
334
|
+
|
335
|
+
* [My final styles](../src/) for [the site](http://www.oddbird.net/susyss/).
|
336
|
+
|
data/sass/susy/_grid.sass
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
:padding-right= columns(!n, !context) + gutter(!context) + "%"
|
52
52
|
|
53
53
|
//**
|
54
|
-
set on the first
|
54
|
+
set on the first element of a row to take side-gutters into account
|
55
55
|
- must override `!nested` for nested columns
|
56
56
|
=alpha(!nested = false)
|
57
57
|
@if !nested
|
@@ -60,10 +60,42 @@
|
|
60
60
|
:margin-left= side_gutter() + "%"
|
61
61
|
|
62
62
|
//**
|
63
|
-
set on the last
|
63
|
+
set on the last element of a row to take side-gutters into account
|
64
64
|
- must override `!nested` for nested columns
|
65
|
-
=omega(!
|
66
|
-
@if !
|
67
|
-
:margin-right 0
|
65
|
+
=omega(!n = false)
|
66
|
+
@if !n
|
67
|
+
:margin-right= 0
|
68
68
|
@else
|
69
69
|
:margin-right= side_gutter() + "%"
|
70
|
+
|
71
|
+
//**
|
72
|
+
use to override +omega in ie.sass for IE6-7 to handle sub-pixel rounding issues
|
73
|
+
- must override `!nested` for nested columns
|
74
|
+
- must override `!right` for right-floated omega elements
|
75
|
+
=ie-omega(!nested = false, !right = false)
|
76
|
+
@if !right
|
77
|
+
@if !nested
|
78
|
+
:margin-right 0
|
79
|
+
@else
|
80
|
+
:margin-right= side_gutter() + "%"
|
81
|
+
:margin-left -1%
|
82
|
+
@else
|
83
|
+
@if !nested
|
84
|
+
:margin-right= -1%
|
85
|
+
@else
|
86
|
+
:margin-right= side_gutter() - 1 + "%"
|
87
|
+
|
88
|
+
|
89
|
+
//**
|
90
|
+
set on an element that will span it's entire context
|
91
|
+
=full(!n = false)
|
92
|
+
+alpha(!n)
|
93
|
+
+omega(!n)
|
94
|
+
|
95
|
+
//**
|
96
|
+
set as shortcut for prefix and suffix
|
97
|
+
=pad(!p = 0, !s = 0, !c = false)
|
98
|
+
@if !p != 0
|
99
|
+
+prefix(!p,!c)
|
100
|
+
@if !s != 0
|
101
|
+
+suffix(!s,!c)
|
data/sass/susy/_utils.sass
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
then adds a grid image of your choosing
|
6
6
|
=show-grid(!src)
|
7
7
|
:background
|
8
|
-
:image=
|
8
|
+
:image= image_url(!src)
|
9
9
|
:repeat repeat
|
10
10
|
:position top left
|
11
11
|
*
|
@@ -50,12 +50,25 @@
|
|
50
50
|
// EXPERIMENTAL
|
51
51
|
|
52
52
|
//**
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
[Opacity rules based on those in Compass Core Edge as of 7.18.09]
|
54
|
+
- These will be removed from Susy once they enter a major Compass release.
|
55
|
+
Provides cross-browser css opacity.
|
56
|
+
@param !opacity
|
57
|
+
A number between 0 and 1, where 0 is transparent and 1 is opaque.
|
58
|
+
=opacity(!opacity)
|
59
|
+
:opacity= !opacity
|
60
|
+
:-moz-opacity= !opacity
|
61
|
+
:-khtml-opacity= !opacity
|
62
|
+
:-ms-filter= "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + round(!opacity*100) + ")"
|
63
|
+
:filter= "alpha(opacity=" + round(!opacity*100) + ")"
|
64
|
+
|
65
|
+
// Make an element completely transparent.
|
66
|
+
=transparent
|
67
|
+
+opacity(0)
|
68
|
+
|
69
|
+
// Make an element completely opaque.
|
70
|
+
=opaque
|
71
|
+
+opacity(1)
|
59
72
|
|
60
73
|
//**
|
61
74
|
rounded corners for Mozilla, Webkit and the future
|
@@ -67,37 +80,25 @@
|
|
67
80
|
/* CSS3
|
68
81
|
border-radius = !r
|
69
82
|
|
70
|
-
=border-
|
83
|
+
=border-corner-radius(!vert, !horz, !r)
|
71
84
|
/* Mozilla (FireFox)
|
72
|
-
-moz-border-radius
|
85
|
+
-moz-border-radius-#{!vert}#{!horz}= !r
|
73
86
|
/* Webkit (Safari, Chrome)
|
74
|
-
-webkit-border-
|
87
|
+
-webkit-border-#{!vert}-#{!horz}-radius= !r
|
75
88
|
/* CSS3
|
76
|
-
border-
|
89
|
+
border-#{!vert}-#{!horz}-radius= !r
|
77
90
|
|
78
|
-
=border-top-
|
79
|
-
|
80
|
-
-moz-border-radius-topright= !tr
|
81
|
-
/* Webkit (Safari, Chrome)
|
82
|
-
-webkit-border-top-right-radius= !tr
|
83
|
-
/* CSS3
|
84
|
-
border-top-right-radius= !tr
|
91
|
+
=border-top-left-radius(!r)
|
92
|
+
+border-corner-radius("top", "left", !r)
|
85
93
|
|
86
|
-
=border-
|
87
|
-
|
88
|
-
-moz-border-radius-bottomright= !br
|
89
|
-
/* Webkit (Safari, Chrome)
|
90
|
-
-webkit-border-bottom-right-radius= !br
|
91
|
-
/* CSS3
|
92
|
-
border-bottom-right-radius= !br
|
94
|
+
=border-top-right-radius(!r)
|
95
|
+
+border-corner-radius("top", "right", !r)
|
93
96
|
|
94
|
-
=border-bottom-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
/* CSS3
|
100
|
-
border-bottom-left-radius= !bl
|
97
|
+
=border-bottom-right-radius(!r)
|
98
|
+
+border-corner-radius("bottom", "right", !r)
|
99
|
+
|
100
|
+
=border-bottom-left-radius(!r)
|
101
|
+
+border-corner-radius("bottom", "left", !r)
|
101
102
|
|
102
103
|
//**
|
103
104
|
change the box model for Mozilla, Webkit, IE8 and the future
|
@@ -4,11 +4,6 @@
|
|
4
4
|
// oddbird.
|
5
5
|
//**
|
6
6
|
|
7
|
-
|
8
|
-
/* RESET STYLES
|
9
|
-
@import compass/reset.sass
|
10
|
-
|
11
|
-
|
12
7
|
//**
|
13
8
|
GRID
|
14
9
|
un-comment and override these values as needed for your grid layout
|
@@ -81,7 +76,6 @@ p
|
|
81
76
|
:list-style disc
|
82
77
|
:margin 0 1.5em 1.5em 1.5em
|
83
78
|
|
84
|
-
|
85
79
|
ol
|
86
80
|
+list-default("ol")
|
87
81
|
|
data/templates/project/ie.sass
CHANGED
@@ -2,5 +2,11 @@
|
|
2
2
|
Welcome to Susy. Use this file to define print styles.
|
3
3
|
Import this file using the following HTML or equivalent:
|
4
4
|
<link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
|
5
|
-
|
6
|
-
@
|
5
|
+
|
6
|
+
/* @group reset */
|
7
|
+
@import compass/reset.sass
|
8
|
+
/* @end */
|
9
|
+
|
10
|
+
/* @group defaults */
|
11
|
+
@import base.sass
|
12
|
+
/* @end */
|
@@ -3,23 +3,51 @@
|
|
3
3
|
Import this file using the following HTML or equivalent:
|
4
4
|
<link href="/stylesheets/screen.css" media="screen" rel="stylesheet" type="text/css" />
|
5
5
|
|
6
|
+
/* @group reset */
|
7
|
+
@import compass/reset.sass
|
8
|
+
/* @end */
|
9
|
+
|
10
|
+
/* @group defaults */
|
6
11
|
@import base.sass
|
12
|
+
/* @end */
|
13
|
+
|
14
|
+
|
15
|
+
/* @group STRUCTURE */
|
16
|
+
|
17
|
+
|
7
18
|
|
8
|
-
/*
|
19
|
+
/* @end */
|
9
20
|
|
10
21
|
|
11
|
-
/* COMPONENTS
|
22
|
+
/* @group COMPONENTS by type */
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
/* @end */
|
27
|
+
|
12
28
|
|
29
|
+
/* @group OVERRIDES by content */
|
13
30
|
|
14
|
-
|
31
|
+
|
32
|
+
|
33
|
+
/* @end */
|
15
34
|
|
16
35
|
|
17
|
-
/*
|
36
|
+
/* @group OVERRIDES by page */
|
37
|
+
|
38
|
+
|
18
39
|
|
40
|
+
/* @end */
|
19
41
|
|
20
|
-
|
21
|
-
|
42
|
+
|
43
|
+
/* @group DEBUG */
|
44
|
+
|
45
|
+
/* uncomment, adjust and use for debugging
|
22
46
|
|
23
|
-
|
47
|
+
/*
|
24
48
|
#page
|
25
|
-
+show-grid("../images/grid.
|
49
|
+
+show-grid("../images/grid.png")
|
50
|
+
div
|
51
|
+
:background rgba(0,0,0,.125)
|
52
|
+
|
53
|
+
/* @end */
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ericam-compass-susy-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Meyer
|
@@ -61,6 +61,9 @@ files:
|
|
61
61
|
- templates/project/manifest.rb
|
62
62
|
- VERSION
|
63
63
|
- LICENSE.txt
|
64
|
+
- docs/tutorial/index.mkdn
|
65
|
+
- docs/tutorial/figures/susy_element.png
|
66
|
+
- docs/tutorial/figures/susy_grid.png
|
64
67
|
- compass-susy-plugin.gemspec
|
65
68
|
has_rdoc: false
|
66
69
|
homepage: http://github.com/ericam/compass-susy-plugin
|