compass 0.12.0 → 0.12.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. checksums.yaml +7 -0
  2. data/README.markdown +18 -46
  3. data/Rakefile +34 -3
  4. data/bin/compass +2 -1
  5. data/features/command_line.feature +1 -0
  6. data/features/step_definitions/command_line_steps.rb +1 -1
  7. data/frameworks/compass/stylesheets/compass/_css3.scss +4 -0
  8. data/frameworks/compass/stylesheets/compass/_support.scss +4 -0
  9. data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +7 -3
  10. data/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +4 -10
  11. data/frameworks/compass/stylesheets/compass/css3/_box.scss +2 -2
  12. data/frameworks/compass/stylesheets/compass/css3/_columns.scss +107 -10
  13. data/frameworks/compass/stylesheets/compass/css3/_filter.scss +23 -0
  14. data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +4 -4
  15. data/frameworks/compass/stylesheets/compass/css3/_hyphenation.scss +77 -0
  16. data/frameworks/compass/stylesheets/compass/css3/_images.scss +2 -2
  17. data/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +13 -7
  18. data/frameworks/compass/stylesheets/compass/css3/_regions.scss +22 -0
  19. data/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +52 -13
  20. data/frameworks/compass/stylesheets/compass/css3/_transform.scss +20 -20
  21. data/frameworks/compass/stylesheets/compass/css3/_transition.scss +128 -61
  22. data/frameworks/compass/stylesheets/compass/reset/_utilities.scss +4 -2
  23. data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +69 -62
  24. data/frameworks/compass/stylesheets/compass/typography/text/_replacement.scss +35 -9
  25. data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +1 -1
  26. data/lib/compass/actions.rb +6 -4
  27. data/lib/compass/commands.rb +4 -3
  28. data/lib/compass/commands/extension_command.rb +60 -0
  29. data/lib/compass/commands/project_base.rb +7 -1
  30. data/lib/compass/commands/update_project.rb +2 -2
  31. data/lib/compass/compiler.rb +1 -2
  32. data/lib/compass/configuration/adapters.rb +8 -2
  33. data/lib/compass/configuration/data.rb +1 -0
  34. data/lib/compass/exec/global_options_parser.rb +8 -1
  35. data/lib/compass/exec/project_options_parser.rb +8 -0
  36. data/lib/compass/sass_extensions/functions/colors.rb +14 -0
  37. data/lib/compass/sass_extensions/functions/constants.rb +9 -0
  38. data/lib/compass/sass_extensions/functions/font_files.rb +4 -2
  39. data/lib/compass/sass_extensions/functions/gradient_support.rb +11 -4
  40. data/lib/compass/sass_extensions/functions/math.rb +1 -1
  41. data/lib/compass/sass_extensions/functions/sprites.rb +10 -2
  42. data/lib/compass/sass_extensions/sprites/engines.rb +3 -3
  43. data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +8 -6
  44. data/lib/compass/sass_extensions/sprites/sprite_methods.rb +3 -2
  45. data/lib/compass/sprite_importer.rb +1 -1
  46. data/lib/compass/version.rb +15 -11
  47. data/test/fixtures/stylesheets/blueprint/css/screen.css +3 -4
  48. data/test/fixtures/stylesheets/blueprint/css/single-imports/buttons.css +6 -8
  49. data/test/fixtures/stylesheets/blueprint/css/single-imports/debug.css +1 -2
  50. data/test/fixtures/stylesheets/blueprint/css/single-imports/fancy-type.css +1 -1
  51. data/test/fixtures/stylesheets/blueprint/css/single-imports/reset-utilities.css +8 -2
  52. data/test/fixtures/stylesheets/compass/css/border_radius.css +0 -6
  53. data/test/fixtures/stylesheets/compass/css/columns.css +126 -12
  54. data/test/fixtures/stylesheets/compass/css/filters.css +29 -0
  55. data/test/fixtures/stylesheets/compass/css/fonts.css +1 -1
  56. data/test/fixtures/stylesheets/compass/css/gradients.css +1 -25
  57. data/test/fixtures/stylesheets/compass/css/grid_background.css +7 -14
  58. data/test/fixtures/stylesheets/compass/css/hyphenation.css +16 -0
  59. data/test/fixtures/stylesheets/compass/css/lists.css +6 -8
  60. data/test/fixtures/stylesheets/compass/css/pie.css +0 -1
  61. data/test/fixtures/stylesheets/compass/css/regions.css +7 -0
  62. data/test/fixtures/stylesheets/compass/css/replacement.css +59 -0
  63. data/test/fixtures/stylesheets/compass/css/reset.css +2 -2
  64. data/test/fixtures/stylesheets/compass/css/text_shadow.css +22 -4
  65. data/test/fixtures/stylesheets/compass/css/transform.css +108 -0
  66. data/test/fixtures/stylesheets/compass/css/transition.css +67 -10
  67. data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +25 -25
  68. data/test/fixtures/stylesheets/compass/sass/columns.scss +19 -0
  69. data/test/fixtures/stylesheets/compass/sass/filters.scss +24 -0
  70. data/test/fixtures/stylesheets/compass/sass/gradients.sass +2 -4
  71. data/test/fixtures/stylesheets/compass/sass/hyphenation.scss +11 -0
  72. data/test/fixtures/stylesheets/compass/sass/regions.scss +4 -0
  73. data/test/fixtures/stylesheets/compass/sass/replacement.scss +22 -0
  74. data/test/fixtures/stylesheets/compass/sass/text_shadow.scss +6 -1
  75. data/test/fixtures/stylesheets/compass/sass/transition.scss +12 -0
  76. data/test/helpers/test_case.rb +8 -1
  77. data/test/integrations/sprites_test.rb +5 -5
  78. data/test/test_helper.rb +2 -1
  79. data/test/units/compass_module_test.rb +1 -1
  80. data/test/units/configuration_test.rb +15 -0
  81. data/test/units/regressions_test.rb +35 -0
  82. data/test/units/sass_extensions_test.rb +33 -11
  83. metadata +62 -222
  84. data/VERSION.yml +0 -5
  85. data/bin/compass.compiled.rbc +0 -707
  86. data/examples/compass/images/emblem-a043c4f148.png +0 -0
  87. data/examples/compass/images/flag-03c3b29b35.png +0 -0
  88. data/examples/compass/images/flag-21cfbfbfc8.png +0 -0
  89. data/examples/css3/extensions/fancy-fonts/templates/project/Prociono.otf +0 -0
  90. data/examples/css3/extensions/fancy-fonts/templates/project/bgrove.otf +0 -0
  91. data/examples/css3/extensions/fancy-fonts/templates/project/bgrove.ttf +0 -0
  92. data/lib/compass.rbc +0 -796
  93. data/lib/compass/actions.rbc +0 -2736
  94. data/lib/compass/app_integration.rbc +0 -836
  95. data/lib/compass/app_integration/merb.rbc +0 -106
  96. data/lib/compass/app_integration/rails.rbc +0 -2096
  97. data/lib/compass/app_integration/rails/configuration_defaults.rbc +0 -2430
  98. data/lib/compass/app_integration/rails/installer.rbc +0 -3677
  99. data/lib/compass/app_integration/stand_alone.rbc +0 -589
  100. data/lib/compass/app_integration/stand_alone/configuration_defaults.rbc +0 -721
  101. data/lib/compass/app_integration/stand_alone/installer.rbc +0 -1487
  102. data/lib/compass/browser_support.rbc +0 -1144
  103. data/lib/compass/commands.rbc +0 -307
  104. data/lib/compass/commands/base.rbc +0 -1044
  105. data/lib/compass/commands/clean_project.rbc +0 -1856
  106. data/lib/compass/commands/create_project.rbc +0 -2691
  107. data/lib/compass/commands/default.rbc +0 -1677
  108. data/lib/compass/commands/generate_grid_background.rbc +0 -1939
  109. data/lib/compass/commands/help.rbc +0 -1921
  110. data/lib/compass/commands/imports.rbc +0 -969
  111. data/lib/compass/commands/installer_command.rbc +0 -807
  112. data/lib/compass/commands/interactive.rbc +0 -1341
  113. data/lib/compass/commands/list_frameworks.rbc +0 -1111
  114. data/lib/compass/commands/print_version.rbc +0 -2478
  115. data/lib/compass/commands/project_base.rbc +0 -2085
  116. data/lib/compass/commands/project_stats.rbc +0 -4202
  117. data/lib/compass/commands/registry.rbc +0 -1350
  118. data/lib/compass/commands/sprite.rbc +0 -2212
  119. data/lib/compass/commands/stamp_pattern.rbc +0 -2011
  120. data/lib/compass/commands/unpack_extension.rbc +0 -2348
  121. data/lib/compass/commands/update_project.rbc +0 -3002
  122. data/lib/compass/commands/validate_project.rbc +0 -1686
  123. data/lib/compass/commands/watch_project.rbc +0 -4155
  124. data/lib/compass/commands/write_configuration.rbc +0 -2896
  125. data/lib/compass/compiler.rbc +0 -4913
  126. data/lib/compass/configuration.rbc +0 -1398
  127. data/lib/compass/configuration/adapters.rbc +0 -2088
  128. data/lib/compass/configuration/comments.rbc +0 -843
  129. data/lib/compass/configuration/data.rbc +0 -2633
  130. data/lib/compass/configuration/defaults.rbc +0 -3617
  131. data/lib/compass/configuration/file_data.rbc +0 -643
  132. data/lib/compass/configuration/helpers.rbc +0 -3500
  133. data/lib/compass/configuration/inheritance.rbc +0 -3592
  134. data/lib/compass/configuration/paths.rbc +0 -412
  135. data/lib/compass/configuration/serialization.rbc +0 -1996
  136. data/lib/compass/dependencies.rbc +0 -232
  137. data/lib/compass/errors.rbc +0 -176
  138. data/lib/compass/exec.rbc +0 -500
  139. data/lib/compass/exec/command_option_parser.rbc +0 -676
  140. data/lib/compass/exec/global_options_parser.rbc +0 -1306
  141. data/lib/compass/exec/helpers.rbc +0 -758
  142. data/lib/compass/exec/project_options_parser.rbc +0 -1515
  143. data/lib/compass/exec/sub_command_ui.rbc +0 -1191
  144. data/lib/compass/frameworks.rbc +0 -3640
  145. data/lib/compass/grid_builder.rbc +0 -0
  146. data/lib/compass/installers.rbc +0 -152
  147. data/lib/compass/installers/bare_installer.rbc +0 -939
  148. data/lib/compass/installers/base.rbc +0 -4427
  149. data/lib/compass/installers/manifest.rbc +0 -3335
  150. data/lib/compass/installers/manifest_installer.rbc +0 -1591
  151. data/lib/compass/installers/template_context.rbc +0 -1030
  152. data/lib/compass/logger.rbc +0 -2317
  153. data/lib/compass/quick_cache.rbc +0 -324
  154. data/lib/compass/sass_extensions.rbc +0 -213
  155. data/lib/compass/sass_extensions/functions.rbc +0 -808
  156. data/lib/compass/sass_extensions/functions/colors.rbc +0 -1279
  157. data/lib/compass/sass_extensions/functions/constants.rbc +0 -1921
  158. data/lib/compass/sass_extensions/functions/cross_browser_support.rbc +0 -1966
  159. data/lib/compass/sass_extensions/functions/display.rbc +0 -1227
  160. data/lib/compass/sass_extensions/functions/enumerate.rbc +0 -446
  161. data/lib/compass/sass_extensions/functions/env.rbc +0 -299
  162. data/lib/compass/sass_extensions/functions/font_files.rbc +0 -821
  163. data/lib/compass/sass_extensions/functions/gradient_support.rbc +0 -14147
  164. data/lib/compass/sass_extensions/functions/image_size.rbc +0 -3152
  165. data/lib/compass/sass_extensions/functions/inline_image.rbc +0 -1678
  166. data/lib/compass/sass_extensions/functions/lists.rbc +0 -2601
  167. data/lib/compass/sass_extensions/functions/selectors.rbc +0 -1592
  168. data/lib/compass/sass_extensions/functions/sprites.rbc +0 -3792
  169. data/lib/compass/sass_extensions/functions/trig.rbc +0 -811
  170. data/lib/compass/sass_extensions/functions/urls.rbc +0 -5248
  171. data/lib/compass/sass_extensions/monkey_patches.rbc +0 -134
  172. data/lib/compass/sass_extensions/monkey_patches/browser_support.rbc +0 -2169
  173. data/lib/compass/sass_extensions/monkey_patches/traversal.rbc +0 -660
  174. data/lib/compass/sass_extensions/sprites.rbc +0 -363
  175. data/lib/compass/sass_extensions/sprites/base.rbc +0 -4529
  176. data/lib/compass/sass_extensions/sprites/engines.rbc +0 -662
  177. data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rbc +0 -1074
  178. data/lib/compass/sass_extensions/sprites/image.rbc +0 -2961
  179. data/lib/compass/sass_extensions/sprites/image_methods.rbc +0 -900
  180. data/lib/compass/sass_extensions/sprites/image_row.rbc +0 -1168
  181. data/lib/compass/sass_extensions/sprites/layout_methods.rbc +0 -3236
  182. data/lib/compass/sass_extensions/sprites/row_fitter.rbc +0 -2067
  183. data/lib/compass/sass_extensions/sprites/sprite_map.rbc +0 -1991
  184. data/lib/compass/sass_extensions/sprites/sprite_methods.rbc +0 -3190
  185. data/lib/compass/sass_extensions/sprites/sprites.rbc +0 -1573
  186. data/lib/compass/sprite_importer.rbc +0 -3573
  187. data/lib/compass/util.rbc +0 -552
  188. data/lib/compass/version.rbc +0 -1245
  189. data/test/fixtures/stylesheets/busted_image_urls/tmp/screen.css +0 -9
  190. data/test/fixtures/stylesheets/envtest/tmp/env.css +0 -2
  191. data/test/helpers/command_line.rbc +0 -2820
  192. data/test/helpers/diff.rbc +0 -1104
  193. data/test/helpers/io.rbc +0 -962
  194. data/test/helpers/rails.rbc +0 -1116
  195. data/test/helpers/test_case.rbc +0 -1255
  196. data/test/integrations/compass_test.rbc +0 -6589
  197. data/test/integrations/rails_integration_test.rbc +0 -1342
  198. data/test/integrations/sprites_test.rbc +0 -6192
  199. data/test/test_helper.rbc +0 -1694
  200. data/test/units/actions_test.rbc +0 -644
  201. data/test/units/command_line_test.rbc +0 -1532
  202. data/test/units/compass_png_test.rbc +0 -0
  203. data/test/units/configuration_test.rbc +0 -3833
  204. data/test/units/rails_configuration_test.rbc +0 -1032
  205. data/test/units/sass_extensions_test.rbc +0 -3586
  206. data/test/units/sprites/engine_test.rbc +0 -962
  207. data/test/units/sprites/image_row_test.rbc +0 -1578
  208. data/test/units/sprites/image_test.rbc +0 -2836
  209. data/test/units/sprites/importer_test.rbc +0 -2620
  210. data/test/units/sprites/row_fitter_test.rbc +0 -1479
  211. data/test/units/sprites/sprite_command_test.rbc +0 -1147
  212. data/test/units/sprites/sprite_map_test.rbc +0 -6515
@@ -17,7 +17,9 @@
17
17
  time, mark, audio, video {
18
18
  @include reset-box-model;
19
19
  @include reset-font; }
20
- body {
20
+ // Unlike Eric's original reset, we reset the html element to be compatible
21
+ // with the vertical rhythm mixins.
22
+ html {
21
23
  @include reset-body; }
22
24
  ol, ul {
23
25
  @include reset-list-style; }
@@ -67,8 +69,8 @@
67
69
 
68
70
  // Reset the font and vertical alignment.
69
71
  @mixin reset-font {
70
- font-size: 100%;
71
72
  font: inherit;
73
+ font-size: 100%;
72
74
  vertical-align: baseline; }
73
75
 
74
76
  // Resets the outline when focus.
@@ -1,18 +1,18 @@
1
1
  @import "compass/layout/grid-background";
2
2
 
3
- // The base font size
3
+ // The base font size.
4
4
  $base-font-size: 16px !default;
5
5
 
6
- // The base line height is the basic unit of line hightness.
6
+ // The base line height determines the basic unit of vertical rhythm.
7
7
  $base-line-height: 24px !default;
8
8
 
9
- // set the default border style for rhythm borders
9
+ // Set the default border style for rhythm borders.
10
10
  $default-rhythm-border-style: solid !default;
11
11
 
12
- // The IE font ratio is a fact of life. Deal with it.
13
- $ie-font-ratio: 16px / 100%;
12
+ // The default font size in all browsers.
13
+ $browser-default-font-size: 16px;
14
14
 
15
- // Set to false if you want to use absolute pixes in sizing your typography.
15
+ // Set to false if you want to use absolute pixels in sizing your typography.
16
16
  $relative-font-sizing: true !default;
17
17
 
18
18
  // Allows the `adjust-font-size-to` mixin and the `lines-for-font-size` function
@@ -25,26 +25,26 @@ $round-to-nearest-half-line: false !default;
25
25
  $min-line-padding: 2px !default;
26
26
 
27
27
  // $base-font-size but in your output unit of choice.
28
- // Defaults to 1em when `$relative-font-sizing`
28
+ // Defaults to 1em when `$relative-font-sizing` is true.
29
29
  $font-unit: if($relative-font-sizing, 1em, $base-font-size) !default;
30
30
 
31
- // The basic unit of font rhythm
31
+ // The basic unit of font rhythm.
32
32
  $base-rhythm-unit: $base-line-height / $base-font-size * $font-unit;
33
33
 
34
34
  // The leader is the amount of whitespace in a line.
35
- // It might be useful in your calculations
35
+ // It might be useful in your calculations.
36
36
  $base-leader: ($base-line-height - $base-font-size) * $font-unit / $base-font-size;
37
37
 
38
38
  // The half-leader is the amount of whitespace above and below a line.
39
- // It might be useful in your calculations
39
+ // It might be useful in your calculations.
40
40
  $base-half-leader: $base-leader / 2;
41
41
 
42
- // True if a number has a relative unit
42
+ // True if a number has a relative unit.
43
43
  @function relative-unit($number) {
44
44
  @return unit($number) == "%" or unit($number) == "em" or unit($number) == "rem"
45
45
  }
46
46
 
47
- // True if a number has an absolute unit
47
+ // True if a number has an absolute unit.
48
48
  @function absolute-unit($number) {
49
49
  @return not (relative-unit($number) or unitless($number));
50
50
  }
@@ -53,24 +53,31 @@ $base-half-leader: $base-leader / 2;
53
53
  @warn "$relative-font-sizing is true but $font-unit is set to #{$font-unit} which is not a relative unit.";
54
54
  }
55
55
 
56
- // Establishes a font baseline for the given font-size in pixels
56
+ // Establishes a font baseline for the given font-size.
57
57
  @mixin establish-baseline($font-size: $base-font-size) {
58
- body {
59
- font-size: $font-size / $ie-font-ratio;
60
- @include adjust-leading-to(1, if($relative-font-sizing, $font-size, $base-font-size));
58
+ // IE 6 refuses to resize fonts set in pixels and it weirdly resizes fonts
59
+ // whose root is set in ems. So we set the root font size in percentages of
60
+ // the default font size.
61
+ * html {
62
+ font-size: 100% * ($font-size / $browser-default-font-size);
61
63
  }
62
- html>body {
64
+ html {
63
65
  font-size: $font-size;
66
+ @include adjust-leading-to(1, if($relative-font-sizing, $font-size, $base-font-size));
64
67
  }
65
68
  }
66
69
 
67
- // resets the baseline to 1 leading unit
70
+ // Resets the line-height to 1 vertical rhythm unit.
71
+ // Does not work on elements whose font-size is different from $base-font-size.
72
+ //
73
+ // @deprecated This mixin will be removed in the next release.
74
+ // Please use the `adjust-leading-to` mixin instead.
68
75
  @mixin reset-baseline {
69
76
  @include adjust-leading-to(1, if($relative-font-sizing, $base-font-size, $base-font-size));
70
77
  }
71
78
 
72
79
  // Show a background image that can be used to debug your alignments.
73
- // include the $img argument if you would rather use your own image than the
80
+ // Include the $img argument if you would rather use your own image than the
74
81
  // Compass default gradient image.
75
82
  @mixin debug-vertical-alignment($img: false) {
76
83
  @if $img {
@@ -80,11 +87,11 @@ $base-half-leader: $base-leader / 2;
80
87
  }
81
88
  }
82
89
 
83
- // Adjust a block to have a different font size and leading to maintain the rhythm.
84
- // $lines is a number that is how many times the baseline rhythm this
85
- // font size should use up. Does not have to be an integer, but it defaults
86
- // to the smallest integer that is large enough to fit the font.
87
- // Use $from_size to adjust from a non-base font-size.
90
+ // Adjust a block to have a different font size and line height to maintain the
91
+ // rhythm. $lines specifies how many multiples of the baseline rhythm each line
92
+ // of this font should use up. It does not have to be an integer, but it
93
+ // defaults to the smallest integer that is large enough to fit the font.
94
+ // Use $from-size to adjust from a font-size other than the base font-size.
88
95
  @mixin adjust-font-size-to($to-size, $lines: lines-for-font-size($to-size), $from-size: $base-font-size) {
89
96
  @if not $relative-font-sizing and $from-size != $base-font-size {
90
97
  @warn "$relative-font-sizing is false but a relative font size was passed to adjust-font-size-to";
@@ -93,25 +100,32 @@ $base-half-leader: $base-leader / 2;
93
100
  @include adjust-leading-to($lines, if($relative-font-sizing, $to-size, $base-font-size));
94
101
  }
95
102
 
103
+ // Adjust a block to have different line height to maintain the rhythm.
104
+ // $lines specifies how many multiples of the baseline rhythm each line of this
105
+ // font should use up. It does not have to be an integer, but it defaults to the
106
+ // smallest integer that is large enough to fit the font.
96
107
  @mixin adjust-leading-to($lines, $font-size: $base-font-size) {
97
- @if not $relative-font-sizing and $font-size != $base-font-size {
98
- @warn "$relative-font-sizing is false but a relative font size was passed to adjust-leading-to";
99
- }
100
- line-height: $font-unit * $lines * $base-line-height / $font-size;
108
+ line-height: rhythm($lines, $font-size);
101
109
  }
102
110
 
103
- // Calculate rhythm units
111
+ // Calculate rhythm units.
104
112
  @function rhythm(
105
113
  $lines: 1,
106
- $font-size: $base-font-size
114
+ $font-size: $base-font-size,
115
+ $offset: 0
107
116
  ) {
108
117
  @if not $relative-font-sizing and $font-size != $base-font-size {
109
118
  @warn "$relative-font-sizing is false but a relative font size was passed to the rhythm function";
110
119
  }
111
- $rhythm: $font-unit * $lines * $base-line-height / $font-size;
120
+ $rhythm: $font-unit * ($lines * $base-line-height - $offset) / $font-size;
121
+ // Round the pixels down to nearest integer.
122
+ @if unit($rhythm) == px {
123
+ $rhythm: floor($rhythm);
124
+ }
112
125
  @return $rhythm;
113
126
  }
114
127
 
128
+ // Calculate the minimum multiple of rhythm units needed to contain the font-size.
115
129
  @function lines-for-font-size($font-size) {
116
130
  $lines: if($round-to-nearest-half-line,
117
131
  ceil(2 * $font-size / $base-line-height) / 2,
@@ -122,46 +136,37 @@ $base-half-leader: $base-leader / 2;
122
136
  @return $lines;
123
137
  }
124
138
 
125
- // Apply leading whitespace
139
+ // Apply leading whitespace. The $property can be margin or padding.
126
140
  @mixin leader($lines: 1, $font-size: $base-font-size, $property: margin) {
127
- $leader: rhythm($lines, $font-size);
128
- @if unit($leader) == px {
129
- $leader: floor($leader)
130
- }
131
- #{$property}-top: $leader;
141
+ #{$property}-top: rhythm($lines, $font-size);
132
142
  }
133
143
 
134
- // Apply leading whitespace as padding
144
+ // Apply leading whitespace as padding.
135
145
  @mixin padding-leader($lines: 1, $font-size: $base-font-size) {
136
- @include leader($lines, $font-size, padding);
146
+ padding-top: rhythm($lines, $font-size);
137
147
  }
138
148
 
139
- // Apply leading whitespace as margin
149
+ // Apply leading whitespace as margin.
140
150
  @mixin margin-leader($lines: 1, $font-size: $base-font-size) {
141
- @include leader($lines, $font-size, margin);
151
+ margin-top: rhythm($lines, $font-size);
142
152
  }
143
153
 
144
- // Apply trailing whitespace
154
+ // Apply trailing whitespace. The $property can be margin or padding.
145
155
  @mixin trailer($lines: 1, $font-size: $base-font-size, $property: margin) {
146
- $leader: rhythm($lines, $font-size);
147
- @if unit($leader) == px {
148
- $leader: ceil($leader)
149
- }
150
- #{$property}-bottom: $leader;
156
+ #{$property}-bottom: rhythm($lines, $font-size);
151
157
  }
152
158
 
153
- // Apply trailing whitespace as padding
159
+ // Apply trailing whitespace as padding.
154
160
  @mixin padding-trailer($lines: 1, $font-size: $base-font-size) {
155
- @include trailer($lines, $font-size, padding);
161
+ padding-bottom: rhythm($lines, $font-size);
156
162
  }
157
163
 
158
- // Apply trailing whitespace as margin
164
+ // Apply trailing whitespace as margin.
159
165
  @mixin margin-trailer($lines: 1, $font-size: $base-font-size) {
160
- @include trailer($lines, $font-size, margin);
166
+ margin-bottom: rhythm($lines, $font-size);
161
167
  }
162
168
 
163
- // Whitespace application shortcut
164
- // Apply top margin/padding + bottom padding/margin
169
+ // Shorthand mixin to apply whitespace for top and bottom margins and padding.
165
170
  @mixin rhythm($leader: 0, $padding-leader: 0, $padding-trailer: 0, $trailer: 0, $font-size: $base-font-size) {
166
171
  @include leader($leader, $font-size);
167
172
  @include padding-leader($padding-leader, $font-size);
@@ -169,8 +174,8 @@ $base-half-leader: $base-leader / 2;
169
174
  @include trailer($trailer, $font-size);
170
175
  }
171
176
 
172
- // Apply a border width to any side without destroying the vertical rhythm.
173
- // The available space ($lines) must be greater than the width of your border.
177
+ // Apply a border and whitespace to any side without destroying the vertical
178
+ // rhythm. The whitespace must be greater than the width of the border.
174
179
  @mixin apply-side-rhythm-border($side, $width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
175
180
  @if not $relative-font-sizing and $font-size != $base-font-size {
176
181
  @warn "$relative-font-sizing is false but a relative font size was passed to apply-side-rhythm-border";
@@ -179,36 +184,38 @@ $base-half-leader: $base-leader / 2;
179
184
  style: $border-style;
180
185
  width: $font-unit * $width / $font-size;
181
186
  };
182
- padding-#{$side}: $font-unit / $font-size * ($lines * $base-line-height - $width);
187
+ padding-#{$side}: rhythm($lines, $font-size, $offset: $width);
183
188
  }
184
189
 
185
- // Aplly rhythm borders equally to all sides
190
+ // Apply borders and whitespace equally to all sides.
186
191
  @mixin rhythm-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
187
192
  @if not $relative-font-sizing and $font-size != $base-font-size {
188
193
  @warn "$relative-font-sizing is false but a relative font size was passed to rhythm-borders";
189
194
  }
190
195
  border: {
191
196
  style: $border-style;
192
- width: $font-unit * $width / $font-size; };
193
- padding: $font-unit / $font-size * ($lines * $base-line-height - $width);
197
+ width: $font-unit * $width / $font-size;
198
+ };
199
+ padding: rhythm($lines, $font-size, $offset: $width);
194
200
  }
195
201
 
196
- // Apply a leading rhythm border
202
+ // Apply a leading border.
197
203
  @mixin leading-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
198
204
  @include apply-side-rhythm-border(top, $width, $lines, $font-size, $border-style);
199
205
  }
200
206
 
201
- // Apply a trailing rhythm border
207
+ // Apply a trailing border.
202
208
  @mixin trailing-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
203
209
  @include apply-side-rhythm-border(bottom, $width, $lines, $font-size, $border-style);
204
210
  }
205
211
 
206
- // Apply both leading and trailing rhythm borders
212
+ // Apply both leading and trailing borders.
207
213
  @mixin horizontal-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
208
214
  @include leading-border($width, $lines, $font-size, $border-style);
209
215
  @include trailing-border($width, $lines, $font-size, $border-style);
210
216
  }
211
217
 
218
+ // Alias for `horizontal-borders` mixin.
212
219
  @mixin h-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
213
220
  @include horizontal-borders($width, $lines, $font-size, $border-style);
214
221
  }
@@ -1,16 +1,27 @@
1
+ // Indicates the direction you prefer to move your text
2
+ // when hiding it.
3
+ //
4
+ // `left` is more robust, especially in older browsers.
5
+ // `right` seems have better runtime performance.
6
+ $hide-text-direction: left !default;
7
+
1
8
  // Hides html text and replaces it with an image.
2
9
  // If you use this on an inline element, you will need to change the display to block or inline-block.
3
10
  // Also, if the size of the image differs significantly from the font size, you'll need to set the width and/or height.
4
11
  //
5
12
  // Parameters:
6
13
  //
7
- // * `img` -- the relative path from the project image directory to the image.
14
+ // * `img` -- the relative path from the project image directory to the image, or a url literal.
8
15
  // * `x` -- the x position of the background image.
9
16
  // * `y` -- the y position of the background image.
10
17
  @mixin replace-text($img, $x: 50%, $y: 50%) {
11
18
  @include hide-text;
12
19
  background: {
13
- image: image-url($img);
20
+ @if is-url($img) {
21
+ image: $img;
22
+ } @else {
23
+ image: image-url($img);
24
+ }
14
25
  repeat: no-repeat;
15
26
  position: $x $y;
16
27
  };
@@ -18,18 +29,33 @@
18
29
 
19
30
  // Like the `replace-text` mixin, but also sets the width
20
31
  // and height of the element according the dimensions of the image.
21
- @mixin replace-text-with-dimensions($img, $x: 50%, $y: 50%) {
22
- @include replace-text($img, $x, $y);
32
+ //
33
+ // If you set `$inline` to true, then an inline image (data uri) will be used.
34
+ @mixin replace-text-with-dimensions($img, $x: 50%, $y: 50%, $inline: false) {
35
+ @include replace-text(if($inline, inline-image($img), $img), $x, $y);
23
36
  width: image-width($img);
24
37
  height: image-height($img);
25
38
  }
26
39
 
27
40
  // Hides text in an element so you can see the background.
28
- @mixin hide-text {
29
- // slightly wider than the box prevents issues with inline-block elements
30
- text-indent: 110%;
31
- white-space: nowrap;
32
- overflow: hidden;
41
+ //
42
+ // The direction indicates how the text should be moved out of view.
43
+ //
44
+ // See `$hide-text-direction` for more information and to set this globally
45
+ // for your application.
46
+ @mixin hide-text($direction: $hide-text-direction) {
47
+ @if $direction == left {
48
+ $approximate-em-value: 12px / 1em;
49
+ $wider-than-any-screen: -9999em;
50
+ text-indent: $wider-than-any-screen * $approximate-em-value;
51
+ overflow: hidden;
52
+ text-align: left;
53
+ } @else {
54
+ // slightly wider than the box prevents issues with inline-block elements
55
+ text-indent: 110%;
56
+ white-space: nowrap;
57
+ overflow: hidden;
58
+ }
33
59
  }
34
60
 
35
61
  // Hides text in an element by squishing the text into oblivion.
@@ -22,7 +22,7 @@ $default-has-layout-approach: zoom !default;
22
22
  }
23
23
 
24
24
  @mixin has-layout-zoom {
25
- @if $legacy-support-for-ie {
25
+ @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
26
26
  *zoom: 1;
27
27
  }
28
28
  }
@@ -10,7 +10,11 @@ module Compass
10
10
  # copy/process a template in the compass template directory to the project directory.
11
11
  def copy(from, to, options = nil, binary = false)
12
12
  options ||= self.options if self.respond_to?(:options)
13
- contents = File.new(from).read
13
+ if binary
14
+ contents = File.new(from,"rb").read
15
+ else
16
+ contents = File.new(from).read
17
+ end
14
18
  write_file to, contents, options, binary
15
19
  end
16
20
 
@@ -51,9 +55,7 @@ module Compass
51
55
  if skip_write
52
56
  FileUtils.touch file_name unless options[:dry_run]
53
57
  else
54
- mode = "w"
55
- mode << "b" if binary
56
- open(file_name, mode) do |file|
58
+ Sass::Util.atomic_create_and_write_file(file_name) do |file|
57
59
  file.write(contents)
58
60
  end
59
61
  end
@@ -4,8 +4,9 @@ end
4
4
  require 'compass/commands/registry'
5
5
 
6
6
  %w(base generate_grid_background default help list_frameworks project_base
7
- update_project watch_project create_project clean_project imports installer_command
8
- print_version project_stats stamp_pattern sprite validate_project
9
- write_configuration interactive unpack_extension).each do |lib|
7
+ update_project watch_project create_project clean_project extension_command
8
+ imports installer_command print_version project_stats stamp_pattern
9
+ sprite validate_project write_configuration interactive unpack_extension
10
+ ).each do |lib|
10
11
  require "compass/commands/#{lib}"
11
12
  end
@@ -0,0 +1,60 @@
1
+ require 'fileutils'
2
+ require 'compass/commands/base'
3
+
4
+ module Compass
5
+ module Commands
6
+ module ExtensionsOptionParser
7
+ def set_options(opts)
8
+ opts.banner = %Q{
9
+ Usage: compass extension install EXTENSION_NAME [options]
10
+ compass extension uninstall EXTENSION_NAME [options]
11
+ compass extension list
12
+
13
+ Description:
14
+ Manage the list of extensions on your system.
15
+ Compass to all of your compass projects.
16
+
17
+ Example:
18
+ compass extension install sassy-buttons
19
+ compass extension uninstall sassy-buttons
20
+
21
+ }
22
+ super
23
+ end
24
+ end
25
+
26
+ class ExtensionCommand < Base
27
+
28
+ register :extension
29
+
30
+ class << self
31
+ def option_parser(arguments)
32
+ parser = Compass::Exec::CommandOptionParser.new(arguments)
33
+ parser.extend(ExtensionsOptionParser)
34
+ end
35
+ def usage
36
+ option_parser([]).to_s
37
+ end
38
+ def description(command)
39
+ "Manage the list of compass extensions on your system"
40
+ end
41
+ def parse!(arguments)
42
+ {:arguments => arguments}
43
+ end
44
+ end
45
+ include InstallerCommand
46
+
47
+ def initialize(working_path, options)
48
+ super(working_path, options)
49
+ end
50
+
51
+ # all commands must implement perform
52
+ def perform
53
+ require 'rubygems/gem_runner'
54
+ Gem::GemRunner.new.run(options[:arguments])
55
+ end
56
+
57
+ end
58
+ end
59
+ end
60
+