chriseppstein-compass 0.6.15 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/CHANGELOG.markdown +170 -0
  2. data/LICENSE.markdown +29 -0
  3. data/README.markdown +10 -2
  4. data/REVISION +1 -1
  5. data/Rakefile +126 -0
  6. data/VERSION.yml +2 -2
  7. data/deps.rip +1 -0
  8. data/examples/blueprint_default/src/images/grid.png +0 -0
  9. data/examples/blueprint_plugins/src/images/grid.png +0 -0
  10. data/examples/blueprint_scoped/images/grid.png +0 -0
  11. data/examples/blueprint_scoped_form/images/grid.png +0 -0
  12. data/examples/blueprint_semantic/src/images/grid.png +0 -0
  13. data/examples/blueprint_semantic/src/liquid.sass +2 -2
  14. data/examples/blueprint_semantic/src/screen.sass +3 -3
  15. data/examples/compass/src/images/blue_arrow.gif +0 -0
  16. data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +42 -0
  17. data/frameworks/blueprint/stylesheets/blueprint/_reset.sass +3 -0
  18. data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +10 -9
  19. data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +35 -23
  20. data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +7 -7
  21. data/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass +56 -0
  22. data/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +2 -2
  23. data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +2 -1
  24. data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +3 -2
  25. data/frameworks/blueprint/templates/project/manifest.rb +2 -1
  26. data/frameworks/blueprint/templates/project/partials/_base.sass +11 -0
  27. data/frameworks/blueprint/templates/project/screen.sass +38 -6
  28. data/frameworks/compass/stylesheets/compass/_utilities.sass +1 -0
  29. data/frameworks/compass/stylesheets/compass/utilities/_sprites.sass +1 -0
  30. data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +106 -28
  31. data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +1 -1
  32. data/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass +12 -0
  33. data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +10 -3
  34. data/frameworks/compass/templates/project/manifest.rb +1 -1
  35. data/frameworks/compass/templates/project/screen.sass +6 -0
  36. data/lib/compass/actions.rb +7 -0
  37. data/lib/compass/{merb.rb → app_integration/merb.rb} +0 -0
  38. data/lib/compass/app_integration/rails/action_controller.rb +15 -0
  39. data/lib/compass/app_integration/rails/image_url.rb +14 -0
  40. data/lib/compass/app_integration/rails/sass_plugin.rb +5 -0
  41. data/lib/compass/app_integration/rails/templates/compass-install-rails.rb +80 -0
  42. data/lib/compass/app_integration/rails.rb +12 -0
  43. data/lib/compass/app_integration.rb +5 -0
  44. data/lib/compass/commands/project_base.rb +12 -2
  45. data/lib/compass/commands/update_project.rb +13 -3
  46. data/lib/compass/commands/watch_project.rb +27 -28
  47. data/lib/compass/commands/write_configuration.rb +5 -1
  48. data/lib/compass/compiler.rb +14 -2
  49. data/lib/compass/configuration.rb +78 -2
  50. data/lib/compass/exec.rb +78 -37
  51. data/lib/compass/installers/base.rb +4 -2
  52. data/lib/compass/installers/rails.rb +3 -2
  53. data/lib/compass/installers/stand_alone.rb +3 -2
  54. data/lib/compass/sass_extensions/functions/display.rb +22 -0
  55. data/lib/compass/sass_extensions/functions/enumerate.rb +6 -0
  56. data/lib/compass/sass_extensions/functions/image_url.rb +88 -0
  57. data/lib/compass/sass_extensions/functions/inline_image.rb +35 -0
  58. data/lib/compass/sass_extensions/functions/selectors.rb +39 -0
  59. data/lib/compass/sass_extensions/functions.rb +19 -0
  60. data/lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb +23 -0
  61. data/lib/compass/sass_extensions/monkey_patches.rb +3 -0
  62. data/lib/compass/sass_extensions.rb +5 -0
  63. data/lib/compass/version.rb +2 -3
  64. data/lib/compass.rb +3 -18
  65. data/test/command_line_helper.rb +102 -0
  66. data/test/command_line_test.rb +2 -106
  67. data/test/compass_test.rb +18 -6
  68. data/test/configuration_test.rb +73 -0
  69. data/test/fixtures/stylesheets/blueprint/images/grid.png +0 -0
  70. data/test/fixtures/stylesheets/compass/css/reset.css +42 -46
  71. data/test/fixtures/stylesheets/compass/sass/reset.sass +9 -0
  72. data/test/fixtures/stylesheets/image_urls/config.rb +17 -0
  73. data/test/fixtures/stylesheets/image_urls/css/screen.css +3 -0
  74. data/test/fixtures/stylesheets/image_urls/images/grid.png +0 -0
  75. data/test/fixtures/stylesheets/image_urls/sass/screen.sass +6 -0
  76. data/test/rails_integration_test.rb +83 -0
  77. data/test/sass_extensions_test.rb +0 -1
  78. data/test/test_case_helper.rb +13 -0
  79. data/test/test_helper.rb +3 -27
  80. data/test/test_rails_helper.rb +20 -0
  81. metadata +51 -4
  82. data/lib/sass_extensions.rb +0 -67
@@ -0,0 +1,56 @@
1
+ // Global reset rules.
2
+ // For more specific resets, use the reset mixins provided below
3
+ =blueprint-global-reset
4
+ html, body
5
+ +blueprint-reset
6
+ +blueprint-nested-reset
7
+
8
+ // Reset all elements within some selector scope.To reset the selector itself,
9
+ // mixin the appropriate reset mixin for that element type as well. This could be
10
+ // useful if you want to style a part of your page in a dramatically different way.
11
+ =blueprint-nested-reset
12
+ div, span, object, iframe, h1, h2, h3, h4, h5, h6, p,
13
+ pre, a, abbr, acronym, address, code, del, dfn, em, img,
14
+ dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, tbody, tfoot, thead, tr
15
+ +blueprint-reset
16
+ blockquote, q
17
+ +blueprint-reset-quotation
18
+ th, td, caption
19
+ +blueprint-reset-table-cell
20
+ table
21
+ +blueprint-reset-table
22
+ a img
23
+ :border none
24
+
25
+ =blueprint-reset-box-model
26
+ :margin 0
27
+ :padding 0
28
+ :border 0
29
+
30
+ =blueprint-reset
31
+ +blueprint-reset-box-model
32
+ :font
33
+ :weight inherit
34
+ :style inherit
35
+ :size 100%
36
+ :family inherit
37
+ :vertical-align baseline
38
+
39
+ =blueprint-reset-quotation
40
+ +blueprint-reset
41
+ :quotes "" ""
42
+ &:before,
43
+ &:after
44
+ :content ""
45
+
46
+ =blueprint-reset-table-cell
47
+ +blueprint-reset
48
+ :text-align left
49
+ :font-weight normal
50
+ :vertical-align middle
51
+
52
+ =blueprint-reset-table
53
+ +blueprint-reset
54
+ :border-collapse separate
55
+ :border-spacing 0
56
+ :vertical-align middle
@@ -66,8 +66,8 @@
66
66
 
67
67
  // Border with more whitespace, spans one column.
68
68
  =colborder
69
- :padding-left= !blueprint_grid_width - 0.5 * !blueprint_grid_margin - 1
70
- :margin-left= !blueprint_grid_width - 0.5 * !blueprint_grid_margin
69
+ :padding-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin - 1)/2
70
+ :margin-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin)/2
71
71
  :border-left 1px solid #eee
72
72
 
73
73
  =rtl-typography(!body_selector = "body")
@@ -16,12 +16,13 @@
16
16
 
17
17
  =blueprint-scaffolding(!body_selector = "body")
18
18
  #{!body_selector}
19
- +blueprint-scaffolding-body
20
19
  @if !body_selector != "body"
21
20
  +blueprint-scaffolding-defaults
22
21
  @if !body_selector == "body"
23
22
  +blueprint-scaffolding-defaults
24
23
 
24
+ // The styles this mixin provides were deprecated in Blueprint 0.9 and is no longer part of the
25
+ // main scaffolding, but the mixin is still available if you want to use it.
25
26
  =blueprint-scaffolding-body
26
27
  :margin 1.5em 0
27
28
 
@@ -4,6 +4,7 @@
4
4
 
5
5
  !blueprint_font_family ||= "Helvetica Neue, Arial, Helvetica, sans-serif"
6
6
  !blueprint_fixed_font_family ||= "'andale mono', 'lucida console', monospace"
7
+ !blueprint_font_size ||= 12px
7
8
 
8
9
  // The +blueprint-typography mixin must be mixed into the top level of your stylesheet.
9
10
  // However, you can customize the body selector if you wish to control the scope
@@ -43,10 +44,10 @@
43
44
  =loud
44
45
  :color= !loud_color
45
46
 
46
- =blueprint-typography-body
47
+ =blueprint-typography-body(!font_size = !blueprint_font_size)
47
48
  :line-height 1.5
48
49
  +normal-text
49
- :font-size 75%
50
+ :font-size= 100% * !font_size / 16px
50
51
 
51
52
  =blueprint-typography-defaults
52
53
  h1
@@ -1,5 +1,6 @@
1
1
  stylesheet 'screen.sass', :media => 'screen, projection'
2
+ stylesheet 'partials/_base.sass'
2
3
  stylesheet 'print.sass', :media => 'print'
3
- stylesheet 'ie.sass', :media => 'screen, projection', :ie => true
4
+ stylesheet 'ie.sass', :media => 'screen, projection', :condition => "lt IE 8"
4
5
 
5
6
  image 'grid.png'
@@ -0,0 +1,11 @@
1
+ // Here is where you can define your constants for your application and to configure the blueprint framework.
2
+ // Feel free to delete these if you want keep the defaults:
3
+
4
+ !blueprint_grid_columns = 24
5
+ !blueprint_container_size = 950px
6
+ !blueprint_grid_margin = 10px
7
+
8
+ // Use this to calculate the width based on the total width.
9
+ // Or you can set !blueprint_grid_width to a fixed value and unset !blueprint_container_size -- it will be calculated for you.
10
+ !blueprint_grid_width = (!blueprint_container_size + !blueprint_grid_margin) / !blueprint_grid_columns - !blueprint_grid_margin
11
+
@@ -1,8 +1,40 @@
1
- @import blueprint.sass
1
+ // This import applies a global reset to any page that imports this stylesheet.
2
+ @import blueprint/reset.sass
3
+ // To configure blueprint, edit the partials/base.sass file.
4
+ @import partials/base.sass
5
+ // Import all the default blueprint modules so that we can access their mixins.
6
+ @import blueprint
7
+ // Import the non-default scaffolding module.
2
8
  @import blueprint/modules/scaffolding.sass
3
- @import compass/reset.sass
4
9
 
5
- +blueprint
6
- // Remove the scaffolding when you're ready to start doing visual design.
7
- // Or leave it in if you're happy with how blueprint looks out-of-the-box
8
- +blueprint-scaffolding
10
+ // To generate css equivalent to the blueprint css but with your configuration applied, uncomment:
11
+ // +blueprint
12
+
13
+ //Recommended Blueprint configuration with scoping and semantic layout:
14
+ body.bp
15
+ +blueprint-typography
16
+ +blueprint-utilities
17
+ +blueprint-debug
18
+ +blueprint-interaction
19
+ // Remove the scaffolding when you're ready to start doing visual design.
20
+ // Or leave it in if you're happy with how blueprint looks out-of-the-box
21
+ +blueprint-scaffolding
22
+ form.bp
23
+ +blueprint-form
24
+
25
+ // Page layout can be done using mixins applied to your semantic classes and IDs:
26
+ body.three-col
27
+ #container
28
+ +container
29
+ #header, #footer
30
+ +column(!blueprint_grid_columns)
31
+ #sidebar
32
+ // One third of the grid columns, rounding down. With 24 cols, this is 8.
33
+ !sidebar_columns = floor(!blueprint_grid_columns / 3)
34
+ +column(!sidebar_columns)
35
+ #content
36
+ // Two thirds of the grid columns, rounding up.
37
+ // With 24 cols, this is 16.
38
+ !content_columns = ceil(2 * !blueprint_grid_columns / 3)
39
+ // true means it's the last column in the row
40
+ +column(!content_columns, true)
@@ -1,5 +1,6 @@
1
1
  @import utilities/general.sass
2
2
  @import utilities/links.sass
3
3
  @import utilities/lists.sass
4
+ @import utilities/sprites.sass
4
5
  @import utilities/tables.sass
5
6
  @import utilities/text.sass
@@ -0,0 +1 @@
1
+ @import sprites/sprite_img.sass
@@ -1,10 +1,42 @@
1
+ // Based on Eric Meyer's reset http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
2
+
1
3
  // Global reset rules.
2
4
  // For more specific resets, use the reset mixins provided below
3
5
  =global-reset
4
- html, body
5
- +reset
6
- +nested-reset
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, font, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ dl, dt, dd, ol, ul, li,
12
+ fieldset, form, label, legend,
13
+ table, caption, tbody, tfoot, thead, tr, th, td
14
+ +reset-box-model
15
+ +reset-font
16
+
17
+ *:focus
18
+ +reset-focus
19
+
20
+ body
21
+ +reset-body
22
+
23
+ ol, ul
24
+ +reset-list-style
7
25
 
26
+ /* tables still need 'cellspacing="0"' in the markup
27
+ table
28
+ +reset-table
29
+
30
+ caption, th, td
31
+ +reset-table-cell
32
+
33
+ q, blockquote
34
+ +reset-quotation
35
+
36
+ img a
37
+ +reset-image-anchor-border
38
+
39
+
8
40
  // Reset all elements within some selector scope.To reset the selector itself,
9
41
  // mixin the appropriate reset mixin for that element type as well. This could be
10
42
  // useful if you want to style a part of your page in a dramatically different way.
@@ -12,45 +44,91 @@
12
44
  div, span, object, iframe, h1, h2, h3, h4, h5, h6, p,
13
45
  pre, a, abbr, acronym, address, code, del, dfn, em, img,
14
46
  dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, tbody, tfoot, thead, tr
15
- +reset
16
- blockquote, q
17
- +reset-quotation
18
- th, td, caption
19
- +reset-table-cell
47
+ +reset-box-model
48
+ +reset-font
49
+
50
+ /* tables still need 'cellspacing="0"' in the markup
20
51
  table
21
52
  +reset-table
22
- a img
23
- :border none
24
-
53
+
54
+ caption, th, td
55
+ +reset-table-cell
56
+
57
+ q, blockquote
58
+ +reset-quotation
59
+
60
+ img a
61
+ +reset-image-anchor-border
62
+
63
+ //Mixins partials
25
64
  =reset-box-model
26
65
  :margin 0
27
66
  :padding 0
28
67
  :border 0
29
-
30
- =reset
31
- +reset-box-model
68
+ :outline 0
69
+
70
+ =reset-font
32
71
  :font
33
72
  :weight inherit
34
73
  :style inherit
35
74
  :size 100%
36
75
  :family inherit
37
76
  :vertical-align baseline
38
-
39
- =reset-quotation
40
- +reset
41
- :quotes "" ""
42
- &:before,
43
- &:after
44
- :content ""
45
-
77
+
78
+ =reset-focus
79
+ :outline 0
80
+
81
+ =reset-body
82
+ :line-height 1em
83
+ :color = #000
84
+ :background #fff
85
+
86
+ =reset-list-style
87
+ :list-style none
88
+
89
+ =reset-table
90
+ :border-collapse separate
91
+ :border-spacing 0
92
+ :vertical-align middle
93
+
46
94
  =reset-table-cell
47
- +reset
48
95
  :text-align left
49
96
  :font-weight normal
50
97
  :vertical-align middle
98
+
99
+ =reset-quotation
100
+ :quotes "" ""
101
+ &:before, &:after
102
+ :content ""
103
+
104
+ =reset-image-anchor-border
105
+ :border none
51
106
 
52
- =reset-table
53
- +reset
54
- :border-collapse separate
55
- :border-spacing 0
56
- :vertical-align middle
107
+ =reset-html5
108
+ section, article, aside, header, footer, nav, dialog, figure
109
+ display: block
110
+
111
+ //**
112
+ Resets the display of inline and block elements to their default display
113
+ according to their tag type. Elements that have a default display that varies across
114
+ versions of html or browser are not handled here, but this covers the 90% use case.
115
+ Usage Example:
116
+ // Turn off the display for both of these classes
117
+ .unregistered-only, .registered-only
118
+ :display none
119
+ // Now turn only one of them back on depending on some other context.
120
+ body.registered
121
+ +reset-display(".registered-only")
122
+ body.unregistered
123
+ +reset-display(".unregistered-only")
124
+ =reset-display(!selector = "", !important = false)
125
+ #{append_selector(elements_of_type("inline"), !selector)}
126
+ @if !important
127
+ display: inline !important
128
+ @else
129
+ display: inline
130
+ #{append_selector(elements_of_type("block"), !selector)}
131
+ @if !important
132
+ display: block !important
133
+ @else
134
+ display: block
@@ -3,7 +3,7 @@
3
3
  :font-size= !base_size
4
4
  :line-height= 1.2 * !base_size
5
5
  .xxs, .xs, .s, .l, .xl, .xxl
6
- :line-height 1.2 !base_size
6
+ :line-height= 1.2 * !base_size
7
7
  .xxs
8
8
  :font-size= !base_size / 2.0
9
9
  .xs
@@ -0,0 +1,12 @@
1
+ !sprite_image_default_width ||= 32px
2
+ !sprite_image_default_height ||= 32px
3
+ !sprite_image_default_margin ||= 0px
4
+
5
+ // Simplest use: +sprite-img("icons-32.png", 1)
6
+ =sprite-img(!img, !col, !row = 1, !width = !sprite_image_default_width, !height = !sprite_image_default_height, !margin = !sprite_image_default_margin)
7
+ !x = ((!col - 1) * -!height) - ((!col - 1) * !margin)
8
+ !y = ((!row - 1) * -!width) - ((!row - 1) * !margin)
9
+ :background= image_url(!img) "no-repeat" !x !y
10
+ :width= !width
11
+ :height= !height
12
+ :overflow hidden
@@ -1,6 +1,13 @@
1
- // Hides html text and replaces it with an image.
2
- // If you use this on an inline element, you will
3
- // need to change the display to block or inline-block.
1
+ //
2
+ Hides html text and replaces it with an image.
3
+ If you use this on an inline element, you will need to change the display to block or inline-block.
4
+ Also, if the size of the image differs significantly from the font size, you'll need to set the width and/or height.
5
+ @param img
6
+ the relative path from the project image directory to the image.
7
+ @param x
8
+ the x position of the background image.
9
+ @param y
10
+ the y position of the background image.
4
11
  =replace-text( !img, !x = 50%, !y = 50% )
5
12
  :text-indent -9999em
6
13
  :overflow hidden
@@ -1,3 +1,3 @@
1
1
  stylesheet 'screen.sass', :media => 'screen, projection'
2
2
  stylesheet 'print.sass', :media => 'print'
3
- stylesheet 'ie.sass', :media => 'screen, projection', :ie => true
3
+ stylesheet 'ie.sass', :media => 'screen, projection', :condition => "IE"
@@ -5,3 +5,9 @@
5
5
  <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
6
6
 
7
7
  @import compass/reset.sass
8
+
9
+ /*
10
+ The *:focus rule is reset and suppresses link outlining.
11
+ You _must_ remember to redefine your own outline, as it’s an important accessibility aid. E.g.
12
+ *:focus
13
+ outline: #ccc dotted medium
@@ -73,6 +73,13 @@ module Compass
73
73
  end
74
74
  end
75
75
 
76
+ def remove(file_name)
77
+ if File.exists?(file_name)
78
+ File.unlink file_name
79
+ logger.record :remove, basename(file_name)
80
+ end
81
+ end
82
+
76
83
  def basename(file)
77
84
  relativize(file) {|f| File.basename(file)}
78
85
  end
File without changes
@@ -0,0 +1,15 @@
1
+ # :stopdoc:
2
+ module ActionController
3
+ class Base
4
+ def process_with_compass(*args)
5
+ Sass::Plugin.rails_controller = self
6
+ begin
7
+ process_without_compass(*args)
8
+ ensure
9
+ Sass::Plugin.rails_controller = nil
10
+ end
11
+ end
12
+ alias_method_chain :process, :compass
13
+ end
14
+ end
15
+ # :startdoc:
@@ -0,0 +1,14 @@
1
+ module Compass::SassExtensions::Functions::ImageUrl
2
+ def image_url_with_rails_integration(path)
3
+ if @controller = Sass::Plugin.rails_controller
4
+ begin
5
+ Sass::Script::String.new "url(#{image_path(path.value)})"
6
+ ensure
7
+ @controller = nil
8
+ end
9
+ else
10
+ image_url_without_rails_integration(path)
11
+ end
12
+ end
13
+ alias_method_chain :image_url, :rails_integration
14
+ end
@@ -0,0 +1,5 @@
1
+ module Sass::Plugin
2
+ class << self
3
+ attr_accessor :rails_controller
4
+ end
5
+ end
@@ -0,0 +1,80 @@
1
+ # =================================================================
2
+ # Compass Ruby on Rails Installer (template) v.1.0
3
+ # written by Derek Perez (derek@derekperez.com)
4
+ # -----------------------------------------------------------------
5
+ # NOTE: This installer is designed to work as a Rails template,
6
+ # and can only be used with Rails 2.3+.
7
+ # -----------------------------------------------------------------
8
+ # Copyright (c) 2009 Derek Perez
9
+ #
10
+ # Permission is hereby granted, free of charge, to any person
11
+ # obtaining a copy of this software and associated documentation
12
+ # files (the "Software"), to deal in the Software without
13
+ # restriction, including without limitation the rights to use,
14
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the
16
+ # Software is furnished to do so, subject to the following
17
+ # conditions:
18
+ #
19
+ # The above copyright notice and this permission notice shall be
20
+ # included in all copies or substantial portions of the Software.
21
+ #
22
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
24
+ # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26
+ # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
27
+ # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29
+ # OTHER DEALINGS IN THE SOFTWARE.
30
+ # =================================================================
31
+ puts "==================================================="
32
+ puts "Welcome to the Compass Installer for Ruby on Rails!"
33
+ puts "==================================================="
34
+ puts
35
+
36
+ # css framework prompt
37
+ css_framework = ask("What CSS Framework do you want to use with Compass? (default: 'blueprint')")
38
+ css_framework = "blueprint" if css_framework.blank?
39
+
40
+ # sass storage prompt
41
+ sass_dir = ask("Where would you like to keep your sass files within your project? (default: 'app/stylesheets')")
42
+ sass_dir = "app/stylesheets" if sass_dir.blank?
43
+
44
+ # compiled css storage prompt
45
+ css_dir = ask("Where would you like Compass to store your compiled css files? (default: 'public/stylesheets/compiled')")
46
+ css_dir = "public/stylesheets/compiled" if css_dir.blank?
47
+
48
+ # define dependencies
49
+ gem "haml-edge", :lib => "haml"
50
+ gem "chriseppstein-compass", :source => "http://gems.github.com/", :lib => "compass"
51
+
52
+ # install and unpack
53
+ rake "gems:install GEM=haml-edge", :sudo => true
54
+ rake "gems:install GEM=chriseppstein-compass", :sudo => true
55
+ rake "gems:unpack GEM=chriseppstein-compass"
56
+
57
+ # load any compass framework plugins
58
+ if css_framework =~ /960/
59
+ gem "chriseppstein-compass-960-plugin", :source => "http://gems.github.com", :lib => "ninesixty"
60
+ rake "gems:install GEM=chriseppstein-compass-960-plugin", :sudo => true
61
+ rake "gems:unpack GEM=chriseppstein-compass-960-plugin"
62
+ css_framework = "960" # rename for command
63
+ plugin_require = "-r ninesixty"
64
+ end
65
+
66
+ # build out compass command
67
+ compass_command = "compass --rails -f #{css_framework} . --css-dir=#{css_dir} --sass-dir=#{sass_dir} "
68
+ compass_command << plugin_require if plugin_require
69
+
70
+ # Require compass during plugin loading
71
+ file 'vendor/plugins/compass/init.rb', <<-CODE
72
+ # This is here to make sure that the right version of sass gets loaded (haml-edge) by the compass requires.
73
+ require 'compass'
74
+ CODE
75
+
76
+ # integrate it!
77
+ run "haml --rails ."
78
+ run compass_command
79
+
80
+ puts "Compass (with #{css_framework}) is all setup, have fun!"
@@ -0,0 +1,12 @@
1
+ unless defined?(Compass::RAILS_LOADED)
2
+ Compass::RAILS_LOADED = true
3
+ require File.join(File.dirname(__FILE__), 'rails', 'action_controller')
4
+ require File.join(File.dirname(__FILE__), 'rails', 'sass_plugin')
5
+ require File.join(File.dirname(__FILE__), 'rails', 'image_url')
6
+ # Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
7
+ class Sass::Script::Functions::EvaluationContext
8
+ include Sass::Script::Functions
9
+ private
10
+ include ActionView::Helpers::AssetTagHelper
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ # If we're running inside Rails
2
+ require File.join(File.dirname(__FILE__), 'app_integration', 'rails') if defined?(ActionController::Base)
3
+
4
+ # If we're running inside Merb
5
+ require File.join(File.dirname(__FILE__), 'app_integration', 'merb') if defined?(Merb::Plugins)
@@ -50,15 +50,25 @@ module Compass
50
50
  # Read the configuration file for this project
51
51
  def read_project_configuration
52
52
  if file = detect_configuration_file
53
- Compass.configuration.parse(file)
53
+ Compass.configuration.parse(file) if File.readable?(file)
54
54
  end
55
55
  end
56
56
 
57
+ def explicit_config_file_must_be_readable?
58
+ true
59
+ end
60
+
57
61
  # TODO: Deprecate the src/config.rb location.
58
- KNOWN_CONFIG_LOCATIONS = ["config/compass.config", "config.rb", "src/config.rb"]
62
+ KNOWN_CONFIG_LOCATIONS = [".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"]
59
63
 
60
64
  # Finds the configuration file, if it exists in a known location.
61
65
  def detect_configuration_file
66
+ if options[:configuration_file]
67
+ if explicit_config_file_must_be_readable? && !File.readable?(options[:configuration_file])
68
+ raise Compass::Error, "Configuration file, #{file}, not found or not readable."
69
+ end
70
+ return options[:configuration_file]
71
+ end
62
72
  KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f)}.detect{|f| File.exists?(f)}
63
73
  end
64
74
 
@@ -11,12 +11,22 @@ module Compass
11
11
  end
12
12
 
13
13
  def perform
14
- compiler = Compass::Compiler.new(working_path,
14
+ compiler = new_compiler_instance
15
+ if compiler.sass_files.empty?
16
+ message = "Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\n"
17
+ message << "Run \"compass -h\" to get help."
18
+ raise Compass::Error, message
19
+ else
20
+ compiler.run
21
+ end
22
+ end
23
+
24
+ def new_compiler_instance(additional_options = {})
25
+ Compass::Compiler.new(working_path,
15
26
  projectize(Compass.configuration.sass_dir),
16
27
  projectize(Compass.configuration.css_dir),
17
28
  Compass.sass_engine_options.merge(:quiet => options[:quiet],
18
- :force => options[:force]))
19
- compiler.run
29
+ :force => options[:force]).merge(additional_options))
20
30
  end
21
31
 
22
32
  end