compass-susy-plugin 0.7.0.pre1 → 0.7.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
data/README.mkdn CHANGED
@@ -68,9 +68,8 @@ Grid Basics
68
68
  * Set defaults for all the important HTML tags in `_defaults.sass`. It's
69
69
  better than using the browser defaults. And better than using ours.
70
70
 
71
- * Create your grid in `screen.sass`: apply the `+susy` mixin to the `body`
72
- element and the `+container` mixin to the element that contains the page
73
- grid.
71
+ * Create your grid in `screen.sass`: apply the `+susy` mixin at the top level
72
+ and the `+container` mixin to the element that contains the page grid.
74
73
 
75
74
  * Use the `+columns` mixin to declare the width in columns of an element,
76
75
  or `+full` for any element spanning the full width of its context.
@@ -89,8 +88,7 @@ Grid Basics
89
88
 
90
89
  That's it for the basics! Here's a sample Susy grid layout:
91
90
 
92
- body
93
- +susy
91
+ +susy
94
92
 
95
93
  #page
96
94
  +container
@@ -128,7 +126,7 @@ Extra utilities are included in Susy's `utils.sass` file, with additional list
128
126
  options, experimental (CSS3/proprietary) CSS, and more.
129
127
 
130
128
  * `+show-grid(!src)` - Repeat the specified grid image on an element. Good for
131
- testing your baseline grid.
129
+ testing your baseline and grid.
132
130
 
133
131
  * `+inline-block-list([!horizontalpadding])` - Make list items inline-block
134
132
  when floating just won't do the trick (if you need them centered or right).
@@ -136,26 +134,24 @@ options, experimental (CSS3/proprietary) CSS, and more.
136
134
  * `+hide` - Hide content from visual browsers while keeping accessability
137
135
  intact.
138
136
 
139
- * `+skip-link([!top = 0, !right, !bottom, !left])` - Hide a link, and then show
137
+ * `+skip-link([!top, !right, !bottom, !left])` - Hide a link, and then show
140
138
  it again on focus. the TRBL settings allow you to place it absolutely on
141
139
  display. Default will be top left of the positioning context.
142
140
 
143
- And then the fun stuff in `_CSS3.sass`:
141
+ And then the fun stuff in `_vertical_rhythm.sass`, written by Chris Eppstein
142
+ and probably moving to the compass core before too long:
144
143
 
145
- * `+opacity(!opacity)` - add cross-browser opacity settings (takes a range of
146
- 0 to 1). `+transprent` and `+opaque` are available as shortcuts.
144
+ * `+adjust-font-size-to(!font_size, [!lines])` - adjust the font size and number
145
+ of baseline (line) units to occupy.
147
146
 
148
- * `+border-radius(!radius)` - Rounded corners in supporting browsers.
149
- `+border-bottom-left-radius` etc. all work.
147
+ * `+leader([!lines, !font_size])` and `+trailer([!lines, !font_size])` - add
148
+ leading or trailing whitespace to an element. These are added as top and
149
+ bottom margins that keep your vertical rhythm intact.
150
150
 
151
- * `+box-sizing(!model)` - Set the box sizing model in supporting browsers.
151
+ * `+top-border([!width, !lines, !font_size])` and `+bottom-border([!width,
152
+ !lines, !font_size])` will combine border and padding to create borders that
153
+ also keep the vertical rhythm going.
152
154
 
153
- * `+box-shadow(!verticaloffset, !horizontaloffset, !blur, !color)` -
154
- Box-shadow in supporting browsers.
155
-
156
- * `+column-count(!number)`, `+column-gap(!length)`, `+column-width(!length)`,
157
- and `+column-rule(!width, !style, !color)` - CSS columns in supporting
158
- browsers.
159
155
 
160
156
  Advanced Options
161
157
  ================
@@ -224,12 +220,13 @@ advanced options hidden inside. Here's a few:
224
220
  * `side_gutter()` is also available and takes no arguments since it is always
225
221
  used at the top nesting level.
226
222
 
227
- * `px2em()` takes one numeric argument representing the number of pixels you
228
- want to mimic. The return is an em value (with no units declared) that
229
- approximates that number of pixels. Useful for keeping your entire design
230
- fluid.
231
-
223
+ * `!px2em` is a variable that represents the height of one pixel as a fraction
224
+ of your base em-height. Multiply it with your target pixel value to
225
+ represent that value in ems.
226
+
232
227
  Example:
233
228
 
234
229
  #nav
235
- border-bottom= px2em(2) + "em"
230
+ border-bottom:
231
+ style: solid
232
+ width= !px2em*2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0.pre1
1
+ 0.7.0.pre2
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{compass-susy-plugin}
5
- s.version = "0.7.0.pre1"
5
+ s.version = "0.7.0.pre2"
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"]
9
- s.date = %q{2009-11-30}
9
+ s.date = %q{2010-01-20}
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", "LICENSE.txt"]
@@ -1,79 +1,68 @@
1
1
  require 'sass'
2
2
 
3
3
  module Sass::Script::Functions
4
- # set the Susy base font size (in pixels)
5
- # return the percentage base font size
6
- # this could be done in Sass, but we need to store the px_size so we
7
- # can provide a px_to_em function
8
- def base_font_size(base_font_size_px)
9
- @@susy_base_font_size_px = Float(base_font_size_px.value)
10
- Sass::Script::Number.new((@@susy_base_font_size_px / 16) * 100)
11
- end
12
4
 
13
- # approximate a given pixel size in ems
14
- def px2em(size_in_px)
15
- Sass::Script::Number.new((size_in_px.value / @@susy_base_font_size_px))
16
- end
5
+ # some helpful constants
6
+ PERCENT = Sass::Script::Number.new(100, ["%"])
7
+ ONE = Sass::Script::Number.new(1)
8
+ TWO = Sass::Script::Number.new(2)
17
9
 
18
10
  # set the Susy column and gutter widths and number of columns
19
- # column, gutter and padding widths should be sent as unitless numbers,
20
- # though they may "really" be ems or pixels (_grid.sass handles units).
21
- # return total width of container (without units)
11
+ # return total width of container
22
12
  def container(total_columns, column_width, gutter_width, side_gutter_width)
23
- @@susy_total_columns = total_columns.value
24
- @@susy_column_width = Float(column_width.value)
25
- @@susy_gutter_width = Float(gutter_width.value)
26
- @@susy_side_gutter_width = Float(side_gutter_width.value)
13
+ @@susy_total_columns = total_columns
14
+ @@susy_column_width = column_width
15
+ @@susy_gutter_width = gutter_width
16
+ @@susy_side_gutter_width = side_gutter_width
27
17
  context
28
18
  end
29
19
 
30
20
  # return the width of 'n' columns plus 'n - 1' gutters
31
21
  # plus page padding in non-nested contexts
32
- def context(n = nil)
33
- begin
34
- n = n.value
35
- rescue NoMethodError
36
- n = false
37
- end
38
- sg = 0
39
- if !n
22
+ def context(n = false)
23
+ raise Sass::SyntaxError, "container() must be called before context() - should be called in susy/susy.sass" unless defined?(@@susy_total_columns)
24
+ sg = Sass::Script::Number.new(0)
25
+ if !n or !n.value
40
26
  n = @@susy_total_columns
41
27
  sg = @@susy_side_gutter_width
42
28
  end
43
29
  c, g = [@@susy_column_width, @@susy_gutter_width]
44
- Sass::Script::Number.new(((n * c) + ((n - 1) * g)) + (sg * 2))
30
+ n.times(c).plus(n.minus(ONE).times(g)).plus(sg.times(TWO))
45
31
  end
46
32
 
47
- # return the percentage width of 'number' columns in a context of
33
+ # return the percentage width of 'n' columns in a context of
48
34
  # 'context_columns'
49
- def columns(number, context_columns = nil)
50
- n = number.value
51
- context_width = context(context_columns).value
35
+ def columns(n, context_columns = false)
36
+ raise Sass::SyntaxError, "container() must be called before columns() - should be called in susy/susy.sass" unless defined?(@@susy_column_width)
37
+ w = context(context_columns)
52
38
  c, g = [@@susy_column_width, @@susy_gutter_width]
53
- Sass::Script::Number.new((((n * c) + ((n - 1) * g)) / context_width) * 100)
39
+ n.times(c).plus(n.minus(ONE).times(g)).div(w).times(PERCENT)
54
40
  end
55
41
 
56
42
  # return the percentage width of a single gutter in a context of
57
43
  # 'context_columns'
58
- def gutter(context_columns = nil)
59
- context_width = context(context_columns).value
44
+ def gutter(context_columns = false)
45
+ raise Sass::SyntaxError, "container() must be called before columns() - should be called in susy/susy.sass" unless defined?(@@susy_gutter_width)
46
+ w = context(context_columns)
60
47
  g = @@susy_gutter_width
61
- Sass::Script::Number.new((g / context_width) * 100)
48
+ g.div(w).times(PERCENT)
62
49
  end
63
50
 
64
51
  # return the percentage width of a single side gutter in a context of
65
52
  # 'context_columns'
66
- def side_gutter(context_columns = nil)
67
- context_width = context(context_columns).value
53
+ def side_gutter(context_columns = false)
54
+ raise Sass::SyntaxError, "container() must be called before side_gutter() - should be called in susy/susy.sass" unless defined?(@@susy_side_gutter_width)
55
+ w = context(context_columns)
68
56
  sg = @@susy_side_gutter_width
69
- Sass::Script::Number.new((sg / context_width) * 100)
57
+ sg.div(w).times(PERCENT)
70
58
  end
71
59
 
72
60
  # return the percentage width of a single column in a context of
73
61
  # 'context_columns'
74
- def column(context_columns = nil)
75
- context_width = context(context_columns).value
62
+ def column(context_columns = false)
63
+ raise Sass::SyntaxError, "container() must be called before column() - should be called in susy/susy.sass" unless defined?(@@susy_column_width)
64
+ w = context(context_columns)
76
65
  c = @@susy_column_width
77
- Sass::Script::Number.new((c / context_width) * 100)
66
+ c.div(w).times(PERCENT)
78
67
  end
79
68
  end
data/sass/susy/_grid.sass CHANGED
@@ -4,11 +4,9 @@
4
4
 
5
5
  // Your basic settings for the grid.
6
6
  // Override these in base.sass to customize your site.
7
- // The grid_unit will be used for col_width, gutter_width and side_gutter_width
8
- !grid_unit ||= "em"
9
7
  !total_cols ||= 12
10
- !col_width ||= 4
11
- !gutter_width ||= 1
8
+ !col_width ||= 4em
9
+ !gutter_width ||= 1em
12
10
  !side_gutter_width ||= !gutter_width
13
11
 
14
12
 
@@ -27,7 +25,7 @@
27
25
  left: auto
28
26
  right: auto
29
27
  // set the page width based on column settings
30
- width= !container_width + !grid_unit
28
+ width= !container_width
31
29
  // never exceed 100% of the browser window (no side-scrolling)
32
30
  max-width: 100%
33
31
 
@@ -43,17 +41,17 @@
43
41
  // the column is floated left
44
42
  +float("left")
45
43
  // the width of the column is set as a percentage of the context
46
- width= columns(!n, !context) + "%"
44
+ width= columns(!n, !context)
47
45
  // the right gutter is added as a percentage of the context
48
- margin-right= gutter(!context) + "%"
46
+ margin-right= gutter(!context)
49
47
 
50
48
 
51
49
  // Set on any element to add empty colums as padding before or after.
52
50
  =prefix(!n, !context = false)
53
- padding-left= columns(!n, !context) + gutter(!context) + "%"
51
+ padding-left= columns(!n, !context) + gutter(!context)
54
52
 
55
53
  =suffix(!n, !context = false)
56
- padding-right= columns(!n, !context) + gutter(!context) + "%"
54
+ padding-right= columns(!n, !context) + gutter(!context)
57
55
 
58
56
 
59
57
  // Set as a shortcut for both prefix and suffix.
@@ -70,7 +68,7 @@
70
68
  // for the sake of consistency. Effect is the same.
71
69
  =alpha(!nested = false)
72
70
  @if !nested == false
73
- margin-left= side_gutter() + "%"
71
+ margin-left= side_gutter()
74
72
 
75
73
 
76
74
  // When global constant !hacks == true:
@@ -92,9 +90,9 @@
92
90
  margin-right: -1%
93
91
  @else
94
92
  @if !hack
95
- #margin-right= !s - 1 + "%"
93
+ #margin-right= !s - 1%
96
94
  @else
97
- margin-right= !s - 1 + "%"
95
+ margin-right= !s - 1%
98
96
 
99
97
 
100
98
  // Sets the direction that +omega elements are floated
@@ -111,7 +109,7 @@
111
109
  @if !nested
112
110
  margin-right: 0
113
111
  @else
114
- margin-right= side_gutter() + "%"
112
+ margin-right= side_gutter()
115
113
  @if !hacks
116
114
  /* ugly hacks for IE6-7 */
117
115
  +ie-omega(!nested, !omega_float, true)
@@ -123,6 +121,6 @@
123
121
  =full(!nested = false)
124
122
  clear: both
125
123
  @if !nested == false
126
- !s = side_gutter() + "%"
124
+ !s = side_gutter()
127
125
  margin-right= !s
128
- margin-left= !s
126
+ margin-left= !s
data/sass/susy/_susy.sass CHANGED
@@ -1,5 +1,5 @@
1
1
  //** Susy **//
2
- // Updated 11.20.2009 by Eric A. Meyer
2
+ // Updated 01.19.2010 by Eric A. Meyer
3
3
 
4
4
 
5
5
  // Tell susy whether you are using hacks or conditional comments.
@@ -15,10 +15,8 @@
15
15
 
16
16
  // Set Susy on your BODY element to get things started.
17
17
  =susy(!align = "center")
18
+ +establish-baseline
18
19
  // text-align set to center by default for auto-centering layouts
19
20
  // - override !align for left/right-aligned designs
20
- text-align= !align
21
- // font size is set against the browser default (usually 16px)
22
- font-size= !base_font_size
23
- line-height= !base_line_height
24
-
21
+ body
22
+ text-align= !align
data/sass/susy/_text.sass CHANGED
@@ -1,15 +1,6 @@
1
1
  //** Susy Text Settings **//
2
- // Updated 11.20.2009 by Eric A. Meyer
2
+ // Updated 01.19.2010 by Eric A. Meyer
3
3
 
4
+ @import vertical_rhythm.sass
4
5
 
5
- // The font size and line height are declared in pixels.
6
- // You override these default settings in base.sass
7
- !base_font_size_px ||= 16
8
- !base_line_height_px ||= 24
9
-
10
-
11
- // Susy will do the math to make those sizes relative.
12
- // We call base_font_size function (even though we could do the math here)
13
- // because Susy needs to "remember" our base_font_size_px for px2em()
14
- !base_font_size = base_font_size(!base_font_size_px) + "%"
15
- !base_line_height = (!base_line_height_px / !base_font_size_px) + "em"
6
+ !px2em = 1px / !base_font_size * 1em
@@ -12,7 +12,7 @@
12
12
  background:
13
13
  image= image_url(!src)
14
14
  repeat: repeat
15
- position= side_gutter() + "% 0"
15
+ position= side_gutter() + " 0"
16
16
 
17
17
 
18
18
  // Brings IE in line with inline-block display
@@ -78,4 +78,4 @@
78
78
  bottom= !b
79
79
  @if !l
80
80
  left= !l
81
- z-index: 999
81
+ z-index: 999
@@ -4,13 +4,19 @@
4
4
  // Site: www.oddbird.net/susy/
5
5
  //**
6
6
 
7
+
8
+ // FONT-SIZE
9
+ // Override these values as needed (defaults are 12/18)
10
+ !base_font_size = 16px
11
+ !base_line_height = 24px
12
+
13
+
7
14
  // GRID
8
15
  // Set these values as needed for your grid layout.
9
16
  // - defaults are shown.
10
- !grid_unit = "em"
11
17
  !total_cols = 12
12
- !col_width = 4
13
- !gutter_width = 1
18
+ !col_width = 4em
19
+ !gutter_width = 1em
14
20
  !side_gutter_width = !gutter_width
15
21
 
16
22
 
@@ -28,15 +34,6 @@
28
34
  // !hacks = true
29
35
 
30
36
 
31
- // FONT-SIZE
32
- // Override these values as needed (defaults are shown)
33
- // - You set the font and line heights in pixels.
34
- // - Susy will do the math and give you !base_font_size and !base_line_height
35
- // variables, set flexibly against the common browser default of 16px
36
- !base_font_size_px = 16
37
- !base_line_height_px = 24
38
-
39
-
40
37
  // SUSY
41
38
  // Don't move this @import above the GRID and FONT-SIZE overrides.
42
39
  @import susy/susy.sass
@@ -44,7 +41,7 @@
44
41
 
45
42
  // COLORS
46
43
  // Set any colors you will need later.
47
- !main = #194C66
44
+ !base = #194C66
48
45
  !alt = #CC6633
49
46
 
50
47
 
@@ -59,4 +56,4 @@
59
56
 
60
57
  // OTHER MIXINS
61
58
  // Mixins set here will be available in defaults, screen, print and IE
62
- // Or anywhere you import either base.sass or defaults.sass
59
+ // Or anywhere you import either base.sass or defaults.sass
@@ -12,12 +12,13 @@
12
12
 
13
13
  body
14
14
  +sans-family
15
- color= !main
15
+ color= !base
16
16
 
17
17
  /* @group links */
18
18
 
19
- \:focus
20
- outline= 1px "dotted" !alt
19
+ a, input, textarea, button
20
+ &:focus
21
+ outline= 1px "dotted" !alt
21
22
 
22
23
  a
23
24
  &:link, &:visited
@@ -37,46 +38,21 @@ h1, h2, h3, h4, h5, h6
37
38
  /* @end */
38
39
 
39
40
 
40
- /* @group forms */
41
-
42
- form *:focus
43
- outline: none
44
-
45
- fieldset
46
- margin= !base_line_height 0
47
-
48
- legend
49
- font-weight: bold
50
- font-variant: small-caps
51
-
52
- label
53
- display: block
54
- margin-top= !base_line_height
55
-
56
- legend + label
57
- margin-top: 0
58
-
59
- textarea, input[type="text"]
60
- +box-sizing("border-box")
61
- width: 100%
62
-
63
- /* @end */
64
-
65
-
66
41
  /* @group tables */
67
42
 
68
43
  /* tables still need 'cellspacing="0"' in the markup */
69
44
 
70
45
  table
71
- :width 100%
72
- :border= 1/16 + "em solid" !main + #333
73
- :left none
74
- :right none
75
- :padding= 7/16 + "em 0"
76
- :margin= 8/16 + "em 0"
46
+ width: 100%
47
+ border:
48
+ width: 0
49
+ style: solid
50
+ color= !base
51
+ +top-border(1px, 0.5)
52
+ +bottom-border(1px, 0.5)
77
53
 
78
54
  th
79
- :font-weight bold
55
+ font-weight: bold
80
56
 
81
57
  /* @end */
82
58
 
@@ -84,19 +60,21 @@ th
84
60
  /* @group block tags */
85
61
 
86
62
  p
87
- :margin= !base_line_height 0
63
+ +leader
64
+ +trailer
88
65
 
89
66
  =list-default(!ol = false)
90
- :margin= !base_line_height
67
+ +leader
68
+ +trailer
91
69
  @if !ol
92
- :list-style decimal
70
+ list-style: decimal
93
71
  @else
94
- :list-style disc
72
+ list-style: disc
95
73
 
96
74
  =no-style-list
97
75
  +no-bullets
98
- :margin 0
99
- :padding 0
76
+ margin: 0
77
+ padding: 0
100
78
 
101
79
  ol
102
80
  +list-default("ol")
@@ -105,7 +83,7 @@ ul
105
83
  +list-default
106
84
 
107
85
  blockquote
108
- :margin= !base_line_height
86
+ margin= !base_rhythm_unit
109
87
  +serif-family
110
88
 
111
89
  /* @end */
@@ -114,24 +92,24 @@ blockquote
114
92
  /* @group inline tags */
115
93
 
116
94
  cite
117
- :font-style italic
95
+ font-style: italic
118
96
 
119
97
  em
120
- :font-style italic
98
+ font-style: italic
121
99
 
122
100
  strong
123
- :font-weight bold
101
+ font-weight: bold
124
102
 
125
103
  ins
126
- :text-decoration underline
104
+ text-decoration: underline
127
105
 
128
106
  del
129
- :text-decoration line-through
107
+ text-decoration: line-through
130
108
 
131
109
  q
132
- :font-style italic
110
+ font-style: italic
133
111
  em
134
- :font-style normal
112
+ font-style: normal
135
113
 
136
114
  /* @end */
137
115
 
@@ -139,7 +117,33 @@ q
139
117
  /* @group replaced tags */
140
118
 
141
119
  img
142
- :vertical-align bottom
120
+ vertical-align: bottom
121
+
122
+ /* @end */
123
+
124
+
125
+ /* @group forms */
126
+
127
+ form *:focus
128
+ outline: none
129
+
130
+ fieldset
131
+ +trailer
132
+
133
+ legend
134
+ font-weight: bold
135
+ font-variant: small-caps
136
+
137
+ label
138
+ display: block
139
+ +leader
140
+
141
+ legend + label
142
+ margin-top: 0
143
+
144
+ textarea, input:not([type="radio"])
145
+ +box-sizing("border-box")
146
+ width: 100%
143
147
 
144
148
  /* @end */
145
149
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass-susy-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.pre1
4
+ version: 0.7.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Meyer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-30 00:00:00 -07:00
12
+ date: 2010-01-20 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency