compass 0.10.6 → 0.11.alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. data/Rakefile +6 -6
  2. data/VERSION.yml +3 -3
  3. data/examples/blueprint_default/parts/forms.html.haml +8 -0
  4. data/examples/css3/src/main.scss +4 -0
  5. data/features/command_line.feature +20 -3
  6. data/features/step_definitions/command_line_steps.rb +7 -1
  7. data/frameworks/blueprint/stylesheets/_blueprint.scss +2 -12
  8. data/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +34 -34
  9. data/frameworks/blueprint/stylesheets/blueprint/_colors.scss +32 -28
  10. data/frameworks/blueprint/stylesheets/blueprint/_debug.scss +3 -3
  11. data/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +2 -2
  12. data/frameworks/blueprint/stylesheets/blueprint/_form.scss +14 -16
  13. data/frameworks/blueprint/stylesheets/blueprint/_grid.scss +39 -37
  14. data/frameworks/blueprint/stylesheets/blueprint/_ie.scss +17 -15
  15. data/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +53 -44
  16. data/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +26 -26
  17. data/frameworks/blueprint/stylesheets/blueprint/_print.scss +13 -20
  18. data/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +32 -44
  19. data/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +10 -12
  20. data/frameworks/blueprint/stylesheets/blueprint/_typography.scss +18 -32
  21. data/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +50 -25
  22. data/frameworks/compass/stylesheets/compass/_css3.scss +1 -15
  23. data/frameworks/compass/stylesheets/compass/_layout.scss +1 -0
  24. data/frameworks/compass/stylesheets/compass/_support.scss +4 -0
  25. data/frameworks/compass/stylesheets/compass/css3/_box-shadow-v2.scss +98 -0
  26. data/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +7 -40
  27. data/frameworks/compass/stylesheets/compass/css3/_box.scss +0 -1
  28. data/frameworks/compass/stylesheets/compass/css3/_columns.scss +23 -18
  29. data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +2 -3
  30. data/frameworks/compass/stylesheets/compass/css3/_gradient.scss +66 -42
  31. data/frameworks/compass/stylesheets/compass/css3/_images.scss +52 -0
  32. data/frameworks/compass/stylesheets/compass/css3/_shared.scss +1 -1
  33. data/frameworks/compass/stylesheets/compass/css3/_text-shadow-v2.scss +72 -0
  34. data/frameworks/compass/stylesheets/compass/css3/_transform-v2.scss +584 -0
  35. data/frameworks/compass/stylesheets/compass/css3/_version-1.scss +16 -0
  36. data/frameworks/compass/stylesheets/compass/css3/_version-2.scss +16 -0
  37. data/frameworks/compass/stylesheets/compass/layout/_stretching.scss +24 -0
  38. data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +4 -4
  39. data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +5 -1
  40. data/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +7 -1
  41. data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +7 -1
  42. data/lib/compass/actions.rb +1 -1
  43. data/lib/compass/app_integration/rails/actionpack3/railtie.rb +18 -0
  44. data/lib/compass/app_integration/rails/configuration_defaults.rb +22 -0
  45. data/lib/compass/app_integration/rails/installer.rb +77 -34
  46. data/lib/compass/app_integration/rails/runtime.rb +3 -0
  47. data/lib/compass/app_integration/stand_alone/configuration_defaults.rb +1 -1
  48. data/lib/compass/commands/print_version.rb +1 -1
  49. data/lib/compass/commands/update_project.rb +2 -2
  50. data/lib/compass/commands/write_configuration.rb +10 -1
  51. data/lib/compass/compiler.rb +1 -5
  52. data/lib/compass/configuration.rb +2 -1
  53. data/lib/compass/configuration/adapters.rb +2 -1
  54. data/lib/compass/configuration/comments.rb +34 -1
  55. data/lib/compass/configuration/helpers.rb +3 -7
  56. data/lib/compass/configuration/paths.rb +1 -1
  57. data/lib/compass/exec/project_options_parser.rb +4 -0
  58. data/lib/compass/installers/base.rb +1 -1
  59. data/lib/compass/logger.rb +4 -2
  60. data/lib/compass/sass_extensions/functions.rb +6 -3
  61. data/lib/compass/sass_extensions/functions/colors.rb +58 -0
  62. data/lib/compass/sass_extensions/functions/constants.rb +1 -1
  63. data/lib/compass/sass_extensions/functions/display.rb +4 -2
  64. data/lib/compass/sass_extensions/functions/gradient_support.rb +343 -25
  65. data/lib/compass/sass_extensions/functions/if.rb +9 -0
  66. data/lib/compass/sass_extensions/functions/inline_image.rb +9 -3
  67. data/lib/compass/sass_extensions/functions/trig.rb +27 -0
  68. data/lib/compass/version.rb +6 -1
  69. data/lib/rails/init.rb +2 -0
  70. data/test/command_line_test.rb +6 -9
  71. data/test/compass_test.rb +2 -0
  72. data/test/configuration_test.rb +20 -0
  73. data/test/fixtures/stylesheets/blueprint/css/ie.css +16 -0
  74. data/test/fixtures/stylesheets/blueprint/css/screen.css +37 -34
  75. data/test/fixtures/stylesheets/blueprint/css/single-imports/colors.css +5 -5
  76. data/test/fixtures/stylesheets/blueprint/css/single-imports/form.css +7 -5
  77. data/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css +5 -5
  78. data/test/fixtures/stylesheets/blueprint/css/single-imports/ie.css +16 -0
  79. data/test/fixtures/stylesheets/blueprint/css/single-imports/interaction.css +12 -9
  80. data/test/fixtures/stylesheets/blueprint/css/single-imports/reset-utilities.css +23 -64
  81. data/test/fixtures/stylesheets/blueprint/css/single-imports/reset.css +13 -37
  82. data/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css +5 -5
  83. data/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css +4 -4
  84. data/test/fixtures/stylesheets/blueprint/css/single-imports/typography.css +12 -15
  85. data/test/fixtures/stylesheets/compass/config.rb +2 -0
  86. data/test/fixtures/stylesheets/compass/css/box.css +6 -13
  87. data/test/fixtures/stylesheets/compass/css/box_shadow.css +17 -0
  88. data/test/fixtures/stylesheets/compass/css/columns.css +47 -0
  89. data/test/fixtures/stylesheets/compass/css/gradients.css +240 -25
  90. data/test/fixtures/stylesheets/compass/css/lists.css +12 -4
  91. data/test/fixtures/stylesheets/compass/css/print.css +1 -1
  92. data/test/fixtures/stylesheets/compass/css/reset.css +2 -2
  93. data/test/fixtures/stylesheets/compass/css/stretching.css +66 -0
  94. data/test/fixtures/stylesheets/compass/css/transform.css +305 -0
  95. data/test/fixtures/stylesheets/compass/sass/box_shadow.scss +5 -0
  96. data/test/fixtures/stylesheets/compass/sass/columns.scss +10 -0
  97. data/test/fixtures/stylesheets/compass/sass/gradients.sass +151 -19
  98. data/test/fixtures/stylesheets/compass/sass/stretching.sass +34 -0
  99. data/test/fixtures/stylesheets/compass/sass/transform.scss +87 -0
  100. data/test/sass_extensions_test.rb +44 -0
  101. metadata +42 -96
  102. data/frameworks/_blueprint_deprecated_imports/stylesheets/_blueprint.sass +0 -2
  103. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_buttons.sass +0 -2
  104. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_colors.sass +0 -2
  105. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_debug.sass +0 -2
  106. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_fancy_type.sass +0 -2
  107. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_form.sass +0 -2
  108. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_grid.sass +0 -2
  109. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_ie.sass +0 -2
  110. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_interaction.sass +0 -2
  111. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_link_icons.sass +0 -2
  112. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_liquid.sass +0 -2
  113. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_print.sass +0 -2
  114. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_reset.sass +0 -2
  115. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_rtl.sass +0 -2
  116. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_scaffolding.sass +0 -2
  117. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_screen.sass +0 -2
  118. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_typography.sass +0 -2
  119. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/_utilities.sass +0 -2
  120. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_buttons.sass +0 -2
  121. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_colors.sass +0 -2
  122. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_debug.sass +0 -2
  123. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_fancy_type.sass +0 -2
  124. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_form.sass +0 -2
  125. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_grid.sass +0 -2
  126. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_interaction.sass +0 -2
  127. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_link_icons.sass +0 -2
  128. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_liquid.sass +0 -2
  129. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_reset.sass +0 -2
  130. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_rtl.sass +0 -2
  131. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_scaffolding.sass +0 -2
  132. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_typography.sass +0 -2
  133. data/frameworks/_blueprint_deprecated_imports/stylesheets/blueprint/modules/_utilities.sass +0 -2
  134. data/frameworks/_compass_deprecated_imports/stylesheets/_compass.sass +0 -2
  135. data/frameworks/_compass_deprecated_imports/stylesheets/compass/_css3.sass +0 -2
  136. data/frameworks/_compass_deprecated_imports/stylesheets/compass/_layout.sass +0 -2
  137. data/frameworks/_compass_deprecated_imports/stylesheets/compass/_misc.sass +0 -1
  138. data/frameworks/_compass_deprecated_imports/stylesheets/compass/_misc.scss +0 -22
  139. data/frameworks/_compass_deprecated_imports/stylesheets/compass/_reset.sass +0 -2
  140. data/frameworks/_compass_deprecated_imports/stylesheets/compass/_utilities.sass +0 -2
  141. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_background_clip.sass +0 -2
  142. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_background_origin.sass +0 -2
  143. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_background_size.sass +0 -2
  144. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_border_radius.sass +0 -2
  145. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_box_shadow.sass +0 -2
  146. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_box_sizing.sass +0 -2
  147. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_columns.sass +0 -2
  148. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_font_face.sass +0 -2
  149. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_gradient.sass +0 -2
  150. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_inline_block.sass +0 -2
  151. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_opacity.sass +0 -2
  152. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_text_shadow.sass +0 -2
  153. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_transform.sass +0 -2
  154. data/frameworks/_compass_deprecated_imports/stylesheets/compass/css3/_transition.sass +0 -2
  155. data/frameworks/_compass_deprecated_imports/stylesheets/compass/layout/_sticky_footer.sass +0 -2
  156. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/_general.sass +0 -2
  157. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/_links.sass +0 -2
  158. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/_lists.sass +0 -2
  159. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/_print.sass +0 -2
  160. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/_sprites.sass +0 -2
  161. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/_tables.sass +0 -2
  162. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/_text.sass +0 -2
  163. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/general/_clearfix.sass +0 -2
  164. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/general/_float.sass +0 -2
  165. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/general/_hacks.sass +0 -2
  166. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/general/_min.sass +0 -2
  167. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/general/_reset.sass +0 -2
  168. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/general/_tabs.sass +0 -0
  169. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/general/_tag_cloud.sass +0 -2
  170. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/links/_hover_link.sass +0 -2
  171. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/links/_link_colors.sass +0 -2
  172. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/links/_unstyled_link.sass +0 -2
  173. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/lists/_bullets.sass +0 -2
  174. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/lists/_horizontal_list.sass +0 -2
  175. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/lists/_inline_list.sass +0 -2
  176. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/sprites/_sprite_img.sass +0 -2
  177. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +0 -2
  178. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/tables/_borders.sass +0 -2
  179. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/tables/_scaffolding.sass +0 -2
  180. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/text/_ellipsis.sass +0 -2
  181. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/text/_nowrap.sass +0 -2
  182. data/frameworks/_compass_deprecated_imports/stylesheets/compass/utilities/text/_replacement.sass +0 -2
@@ -0,0 +1,16 @@
1
+ @import "border-radius";
2
+ @import "inline-block";
3
+ @import "opacity";
4
+ @import "box-shadow";
5
+ @import "text-shadow";
6
+ @import "columns";
7
+ @import "box-sizing";
8
+ @import "box";
9
+ @import "images";
10
+ @import "gradient";
11
+ @import "background-clip";
12
+ @import "background-origin";
13
+ @import "background-size";
14
+ @import "font-face";
15
+ @import "transform";
16
+ @import "transition";
@@ -0,0 +1,16 @@
1
+ @import "border-radius";
2
+ @import "inline-block";
3
+ @import "opacity";
4
+ @import "box-shadow-v2";
5
+ @import "text-shadow-v2";
6
+ @import "columns";
7
+ @import "box-sizing";
8
+ @import "box";
9
+ @import "images";
10
+ @import "gradient";
11
+ @import "background-clip";
12
+ @import "background-origin";
13
+ @import "background-size";
14
+ @import "font-face";
15
+ @import "transform-v2";
16
+ @import "transition";
@@ -0,0 +1,24 @@
1
+
2
+ // stretch element height to specified top and bottom position
3
+
4
+ @mixin stretch-y($offset-top:0, $offset-bottom:0) {
5
+ @include stretch($offset-top, false, $offset-bottom, false);
6
+ }
7
+
8
+
9
+ // stretch element width to specified left and right position
10
+
11
+ @mixin stretch-x($offset-left:0, $offset-right:0) {
12
+ @include stretch(false, $offset-right, false, $offset-left);
13
+ }
14
+
15
+
16
+ // shorthand to stretch element height and width
17
+
18
+ @mixin stretch($offset-top:0, $offset-right:0, $offset-bottom:0, $offset-left:0) {
19
+ position: absolute;
20
+ @if $offset-top { top: $offset-top; }
21
+ @if $offset-bottom { bottom: $offset-bottom; }
22
+ @if $offset-left { left: $offset-left; }
23
+ @if $offset-right { right: $offset-right; }
24
+ }
@@ -8,14 +8,14 @@ $default-has-layout-approach: zoom !default;
8
8
  // This mixin causes an element matching the selector
9
9
  // to gain the "hasLayout" property in internet explorer.
10
10
  // More information on [hasLayout](http://reference.sitepoint.com/css/haslayout).
11
- @mixin has-layout($using: $default-has-layout-approach) {
11
+ @mixin has-layout($approach: $default-has-layout-approach) {
12
12
  @if $legacy-support-for-ie {
13
- @if $using == zoom {
13
+ @if $approach == zoom {
14
14
  @include has-layout-zoom;
15
- } @else if $using == block {
15
+ } @else if $approach == block {
16
16
  @include has-layout-block;
17
17
  } @else {
18
- @warn "Unknown has-layout approach: #{$using}";
18
+ @warn "Unknown has-layout approach: #{$approach}";
19
19
  @include has-layout-zoom;
20
20
  }
21
21
  }
@@ -31,6 +31,9 @@
31
31
  //
32
32
  // :last-child is not fully supported
33
33
  // see http://www.quirksmode.org/css/contents.html#t29 for the support matrix
34
+ //
35
+ // IE8 ignores rules that are included on the same line as :last-child
36
+ // see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details
34
37
  //
35
38
  // Setting `$padding` to `false` disables the padding between list elements
36
39
  @mixin horizontal-list-item($padding: 4px, $direction: left) {
@@ -43,7 +46,8 @@
43
46
  right: $padding;
44
47
  }
45
48
  &:first-child, &.first { padding-#{$direction}: 0; }
46
- &:last-child, &.last { padding-#{opposite-position($direction)}: 0; }
49
+ &:last-child { padding-#{opposite-position($direction)}: 0; }
50
+ &.last { padding-#{opposite-position($direction)}: 0; }
47
51
  }
48
52
  }
49
53
 
@@ -17,12 +17,18 @@
17
17
  //
18
18
  // `:last-child` is not fully supported.
19
19
  // see quirksmode for the [support matrix](http://www.quirksmode.org/css/contents.html#t29).
20
+ //
21
+ // IE8 ignores rules that are included on the same line as :last-child
22
+ // see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details
20
23
 
21
24
  @mixin comma-delimited-list {
22
25
  @include inline-list;
23
26
  li {
24
27
  &:after { content: ", "; }
25
- &:last-child, &.last {
28
+ &:last-child {
29
+ &:after { content: ""; }
30
+ }
31
+ &.last {
26
32
  &:after { content: ""; }
27
33
  }
28
34
  }
@@ -20,8 +20,14 @@
20
20
  &:last-child,
21
21
  &.last {
22
22
  border-right-width: 0px; } }
23
+
24
+ // IE8 ignores rules that are included on the same line as :last-child
25
+ // see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details
26
+
23
27
  tbody, tfoot {
24
- tr:last-child,
28
+ tr:last-child {
29
+ th, td {
30
+ border-bottom-width: 0px; } }
25
31
  tr.last {
26
32
  th, td {
27
33
  border-bottom-width: 0px; } } } }
@@ -18,7 +18,7 @@ module Compass
18
18
  def directory(dir, options = nil)
19
19
  options ||= self.options if self.respond_to?(:options)
20
20
  if File.exists?(dir) && File.directory?(dir)
21
- logger.record :exists, basename(dir) unless options[:quiet]
21
+ # logger.record :exists, basename(dir) unless options[:quiet]
22
22
  elsif File.exists?(dir)
23
23
  msg = "#{basename(dir)} already exists and is not a directory."
24
24
  raise Compass::FilesystemConflict.new(msg)
@@ -0,0 +1,18 @@
1
+ require 'compass'
2
+ require 'rails'
3
+ module Compass
4
+ class Railtie < Rails::Railtie
5
+ config.to_prepare do
6
+ # putting this here allows compass to detect
7
+ # and adjust to changes to the project configuration
8
+ Compass.reset_configuration!
9
+ Compass::AppIntegration::Rails.initialize!
10
+ end
11
+
12
+ initializer "compass/railtie.configure_rails_initialization" do |app|
13
+ # XXX How do I only do this if it's not done yet?
14
+ # require 'sass/plugin/rack'
15
+ # app.middleware.use Sass::Plugin::Rack
16
+ end
17
+ end
18
+ end
@@ -7,6 +7,16 @@ module Compass
7
7
  :rails
8
8
  end
9
9
 
10
+ def default_sass_dir
11
+ # XXX Maybe this should be: app/views/stylesheets
12
+ # or maybe layouts should be moved up a level.
13
+ File.join("app", "stylesheets")
14
+ end
15
+
16
+ def default_css_dir
17
+ File.join("public", "stylesheets")
18
+ end
19
+
10
20
  def default_images_dir
11
21
  File.join("public", "images")
12
22
  end
@@ -43,6 +53,18 @@ module Compass
43
53
  File.join("tmp", "sass-cache")
44
54
  end
45
55
 
56
+ def default_project_path
57
+ project_path = Compass::AppIntegration::Rails.root
58
+ end
59
+
60
+ def default_http_path
61
+ "/" # XXX Where is/was this stored in the Rails config?
62
+ end
63
+
64
+ def default_environment
65
+ Compass::AppIntegration::Rails.env
66
+ end
67
+
46
68
  end
47
69
  end
48
70
  end
@@ -23,28 +23,36 @@ module Compass
23
23
  directory File.dirname(config_file)
24
24
  write_file config_file, config_contents
25
25
  end
26
- directory File.dirname(targetize('config/initializers/compass.rb'))
27
- write_file targetize('config/initializers/compass.rb'), initializer_contents
26
+ unless rails3?
27
+ directory File.dirname(targetize('config/initializers/compass.rb'))
28
+ write_file targetize('config/initializers/compass.rb'), initializer_contents
29
+ end
30
+ end
31
+
32
+ def rails3?
33
+ File.exists?(targetize('config/application.rb'))
28
34
  end
29
35
 
30
36
  def prepare
31
37
  write_configuration_files
32
38
  end
33
39
 
40
+ def gem_config_instructions
41
+ if rails3?
42
+ %Q{Add the following to your Gemfile:\n\n gem "compass", ">= #{Compass::VERSION}"}
43
+ else
44
+ %Q{Add the following to your environment.rb:\n\n config.gem "compass", :version => ">= #{Compass::VERSION}"}
45
+ end
46
+ end
47
+
34
48
  def finalize(options = {})
35
49
  if options[:create]
36
50
  puts <<-NEXTSTEPS
37
51
 
38
52
  Congratulations! Your rails project has been configured to use Compass.
39
- Just one more thing left to do: Register the compass gem.
40
-
41
- In Rails 2.2 & 2.3, add the following to your environment.rb:
42
-
43
- config.gem "compass", :version => ">= #{Compass::VERSION}"
53
+ Just a couple more things left to do.
44
54
 
45
- In Rails 3, add the following to your Gemfile:
46
-
47
- gem "compass", ">= #{Compass::VERSION}"
55
+ #{gem_config_instructions}
48
56
 
49
57
  Then, make sure you restart your server.
50
58
 
@@ -54,52 +62,61 @@ NEXTSTEPS
54
62
  end
55
63
  unless options[:prepare]
56
64
  if manifest.has_stylesheet?
57
- puts "\nNext add these lines to the head of your layouts:\n\n"
65
+ puts "\nNow add these lines to the head of your layout(s):\n\n"
58
66
  puts stylesheet_links
59
- puts "\n(You are using haml, aren't you?)"
60
67
  end
61
68
  end
62
69
  end
63
70
 
71
+ def hamlize?
72
+ # XXX Is there a better way to detect haml in a particular rails project?
73
+ require 'haml'
74
+ true
75
+ rescue LoadError
76
+ false
77
+ end
64
78
 
65
79
  def install_location_for_html(to, options)
66
80
  separate("public/#{pattern_name_as_dir}#{to}")
67
81
  end
68
82
 
69
83
  def prompt_sass_dir
70
- recommended_location = separate('app/stylesheets')
71
- default_location = separate('public/stylesheets/sass')
72
- print %Q{Compass recommends that you keep your stylesheets in #{recommended_location}
84
+ if rails3?
85
+ nil
86
+ else
87
+ recommended_location = separate('app/stylesheets')
88
+ default_location = separate('public/stylesheets/sass')
89
+ print %Q{Compass recommends that you keep your stylesheets in #{recommended_location}
73
90
  instead of the Sass default location of #{default_location}.
74
91
  Is this OK? (Y/n) }
75
- answer = $stdin.gets.downcase[0]
76
- answer == ?n ? default_location : recommended_location
92
+ answer = $stdin.gets.downcase[0]
93
+ answer == ?n ? default_location : recommended_location
94
+ end
77
95
  end
78
96
 
79
97
  def prompt_css_dir
80
- recommended_location = separate("public/stylesheets/compiled")
81
- default_location = separate("public/stylesheets")
82
- puts
83
- print %Q{Compass recommends that you keep your compiled css in #{recommended_location}/
98
+ if rails3?
99
+ nil
100
+ else
101
+ recommended_location = separate("public/stylesheets/compiled")
102
+ default_location = separate("public/stylesheets")
103
+ puts
104
+ print %Q{Compass recommends that you keep your compiled css in #{recommended_location}/
84
105
  instead the Sass default of #{default_location}/.
85
106
  However, if you're exclusively using Sass, then #{default_location}/ is recommended.
86
107
  Emit compiled stylesheets to #{recommended_location}/? (Y/n) }
87
- answer = $stdin.gets
88
- answer = answer.downcase[0]
89
- answer == ?n ? default_location : recommended_location
108
+ answer = $stdin.gets
109
+ answer = answer.downcase[0]
110
+ answer == ?n ? default_location : recommended_location
111
+ end
90
112
  end
91
113
 
92
114
  def config_contents
93
- "# This configuration file works with both the Compass command line tool and within Rails.\n" +
94
- Compass.configuration.serialize do |prop, value|
95
- if prop == :project_path
96
- "project_path = Compass::AppIntegration::Rails.root\n"
97
- elsif prop == :environment
98
- "environment = Compass::AppIntegration::Rails.env\n"
99
- elsif prop == :output_style
100
- ""
101
- end
102
- end
115
+ project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil
116
+ ("# This configuration file works with both the Compass command line tool and within Rails.\n" +
117
+ Compass.configuration.serialize)
118
+ ensure
119
+ Compass.configuration.project_path = project_path
103
120
  end
104
121
 
105
122
  def initializer_contents
@@ -118,6 +135,14 @@ NEXTSTEPS
118
135
  end
119
136
 
120
137
  def stylesheet_links
138
+ if hamlize?
139
+ haml_stylesheet_links
140
+ else
141
+ html_stylesheet_links
142
+ end
143
+ end
144
+
145
+ def haml_stylesheet_links
121
146
  html = "%head\n"
122
147
  manifest.each_stylesheet do |stylesheet|
123
148
  # Skip partials.
@@ -133,6 +158,24 @@ NEXTSTEPS
133
158
  end
134
159
  html
135
160
  end
161
+ def html_stylesheet_links
162
+ html = "<head>\n"
163
+ manifest.each_stylesheet do |stylesheet|
164
+ # Skip partials.
165
+ next if File.basename(stylesheet.from)[0..0] == "_"
166
+ ss_line = "<%= stylesheet_link_tag '#{stylesheet_prefix}#{stylesheet.to.sub(/\.sass$/,'.css')}'"
167
+ if stylesheet.options[:media]
168
+ ss_line += ", :media => '#{stylesheet.options[:media]}'"
169
+ end
170
+ ss_line += " %>"
171
+ if stylesheet.options[:condition]
172
+ ss_line = "<!--[if #{stylesheet.options[:condition]}]>" + ss_line + "<![endif]-->"
173
+ end
174
+ html << " #{ss_line}\n"
175
+ end
176
+ html << "</head>"
177
+ html
178
+ end
136
179
  end
137
180
  end
138
181
  end
@@ -4,6 +4,9 @@ unless defined?(Compass::RAILS_LOADED)
4
4
  require 'action_pack/version'
5
5
  if ActionPack::VERSION::MAJOR >= 3
6
6
  # TODO figure something out so image_path works with rails integration
7
+ %w(railtie).each do |lib|
8
+ require "compass/app_integration/rails/actionpack3/#{lib}"
9
+ end
7
10
  else
8
11
  %w(action_controller sass_plugin urls).each do |lib|
9
12
  require "compass/app_integration/rails/actionpack2/#{lib}"
@@ -7,7 +7,7 @@ module Compass
7
7
  end
8
8
 
9
9
  def sass_dir_without_default
10
- "src"
10
+ "sass"
11
11
  end
12
12
 
13
13
  def javascripts_dir_without_default
@@ -81,7 +81,7 @@ Options:
81
81
  else
82
82
  lines = []
83
83
  lines << "Compass #{::Compass.version[:string]}"
84
- lines << "Copyright (c) 2008-2009 Chris Eppstein"
84
+ lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein"
85
85
  lines << "Released under the MIT License."
86
86
  puts lines.join("\n")
87
87
  end
@@ -47,10 +47,10 @@ module Compass
47
47
 
48
48
  def new_compiler_instance(additional_options = {})
49
49
  compiler_opts = Compass.sass_engine_options
50
- compiler_opts.merge!(:quiet => options[:quiet],
51
- :force => options[:force],
50
+ compiler_opts.merge!(:force => options[:force],
52
51
  :sass_files => explicit_sass_files,
53
52
  :dry_run => options[:dry_run])
53
+ compiler_opts[:quiet] = options[:quiet] if options[:quiet]
54
54
  compiler_opts.merge!(additional_options)
55
55
  Compass::Compiler.new(working_path,
56
56
  Compass.configuration.sass_path,
@@ -20,6 +20,9 @@ module Compass
20
20
  opts.on("--debug [PROPERTY]", "Debug your configuration by printing out details.") do |prop|
21
21
  self.options[:debug] = prop.nil? ? true : prop.to_sym
22
22
  end
23
+ opts.on("-p PROPERTY", "--property PROPERTY", "Print out the value of a particular configuration property") do |prop|
24
+ self.options[:display] = prop.to_sym
25
+ end
23
26
 
24
27
  super
25
28
  end
@@ -40,7 +43,13 @@ module Compass
40
43
  end
41
44
 
42
45
  def perform
43
- if options[:debug]
46
+ if options[:display]
47
+ if Compass.configuration.respond_to?(options[:display])
48
+ puts Compass.configuration.send(options[:display])
49
+ else
50
+ raise Compass::Error, "ERROR: configuration property '#{options[:display]}' does not exist"
51
+ end
52
+ elsif options[:debug]
44
53
  puts "Configuration sources:"
45
54
  c = Compass.configuration
46
55
  while c
@@ -11,6 +11,7 @@ module Compass
11
11
  self.logger = options.delete(:logger)
12
12
  self.options = options
13
13
  self.options[:cache_location] ||= determine_cache_location
14
+ Compass.configure_sass_plugin!
14
15
  end
15
16
 
16
17
  def determine_cache_location
@@ -40,7 +41,6 @@ module Compass
40
41
 
41
42
  # Returns the sass file that needs to be compiled, if any.
42
43
  def out_of_date?
43
- Compass.configure_sass_plugin! unless Compass.sass_plugin_configured?
44
44
  sass_files.zip(css_files).each do |sass_filename, css_filename|
45
45
  return sass_filename if Sass::Plugin.send(:stylesheet_needs_update?, css_filename, sass_filename)
46
46
  end
@@ -72,9 +72,6 @@ module Compass
72
72
  options[:force] = true
73
73
  end
74
74
 
75
- # We use the Sass::Plugin to check dependencies so we have configure it.
76
- Compass.configure_sass_plugin! unless Compass.sass_plugin_configured?
77
-
78
75
  # Make sure the target directories exist
79
76
  target_directories.each {|dir| directory dir}
80
77
 
@@ -98,7 +95,6 @@ module Compass
98
95
 
99
96
  # Compile one Sass file
100
97
  def compile(sass_filename, css_filename)
101
- logger.record :compile, basename(sass_filename) unless options[:quiet]
102
98
  css_content = logger.red do
103
99
  engine(sass_filename, css_filename).render
104
100
  end