compass 0.10.0.pre2 → 0.10.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/CHANGELOG.markdown +41 -0
  2. data/REVISION +1 -1
  3. data/VERSION.yml +1 -1
  4. data/features/command_line.feature +22 -1
  5. data/features/step_definitions/command_line_steps.rb +11 -0
  6. data/lib/compass/actions.rb +0 -18
  7. data/lib/compass/app_integration/rails/configuration_defaults.rb +5 -1
  8. data/lib/compass/app_integration/rails/templates/compass-install-rails.rb +18 -9
  9. data/lib/compass/app_integration/stand_alone/configuration_defaults.rb +4 -0
  10. data/lib/compass/commands/generate_grid_background.rb +1 -5
  11. data/lib/compass/commands/update_project.rb +21 -6
  12. data/lib/compass/compiler.rb +84 -15
  13. data/lib/compass/configuration.rb +2 -0
  14. data/lib/compass/configuration/adapters.rb +4 -0
  15. data/lib/compass/configuration/defaults.rb +10 -0
  16. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_fancy_type.sass +1 -1
  17. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_buttons.sass.html +26 -0
  18. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_colors.sass.html +1 -0
  19. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_debug.sass.html +1 -0
  20. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_fancy_type.sass.html +45 -0
  21. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_form.sass.html +3 -0
  22. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_grid.sass.html +46 -0
  23. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_ie.sass.html +7 -0
  24. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_interaction.sass.html +1 -0
  25. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_link_icons.sass.html +1 -0
  26. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_liquid.sass.html +7 -0
  27. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_print.sass.html +7 -0
  28. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_reset.sass.html +7 -0
  29. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_rtl.sass.html +38 -0
  30. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_scaffolding.sass.html +11 -0
  31. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_screen.sass.html +1 -0
  32. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_typography.sass.html +3 -0
  33. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/_utilities.sass.html +3 -0
  34. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/index.html +31 -0
  35. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_buttons.sass.html +1 -0
  36. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_colors.sass.html +1 -0
  37. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_debug.sass.html +1 -0
  38. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_fancy_type.sass.html +1 -0
  39. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_form.sass.html +1 -0
  40. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_grid.sass.html +1 -0
  41. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_interaction.sass.html +1 -0
  42. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_link_icons.sass.html +1 -0
  43. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_liquid.sass.html +1 -0
  44. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_reset.sass.html +1 -0
  45. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_rtl.sass.html +1 -0
  46. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_scaffolding.sass.html +1 -0
  47. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_typography.sass.html +1 -0
  48. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/docs/modules/_utilities.sass.html +1 -0
  49. data/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass +9 -0
  50. data/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_min.sass +17 -0
  51. data/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +7 -2
  52. data/lib/compass/grid_builder.rb +61 -38
  53. data/lib/compass/logger.rb +23 -4
  54. data/lib/vendor/fssm.rb +169 -34
  55. data/lib/vendor/fssm/backends/fsevents.rb +5 -5
  56. data/lib/vendor/fssm/backends/inotify.rb +25 -0
  57. data/lib/vendor/fssm/backends/polling.rb +2 -2
  58. data/lib/vendor/fssm/{fsevents.rb → backends/rubycocoa/fsevents.rb} +22 -20
  59. data/lib/vendor/fssm/path.rb +3 -3
  60. data/lib/vendor/fssm/pathname.rb +528 -0
  61. data/lib/vendor/fssm/state.rb +3 -3
  62. data/lib/vendor/fssm/support.rb +33 -3
  63. data/lib/vendor/fssm/tree.rb +47 -47
  64. data/test/compass_png_test.rb +46 -0
  65. metadata +41 -6
  66. data/lib/vendor/fssm/cache.rb +0 -193
  67. data/lib/vendor/fssm/ext.rb +0 -37
@@ -1,6 +1,41 @@
1
1
  COMPASS CHANGELOG
2
2
  =================
3
3
 
4
+ 0.10.0.pre3 (January 02, 2010)
5
+ ------------------------------
6
+
7
+ Bug fixes:
8
+
9
+ * [Blueprint] Bug Fix: variable referenced in a non-script context within the
10
+ dquo mixin in the fancy_type module.
11
+ * [Rails] fixed win32 sudo incompatibility issue in the rails installer template.
12
+ (Credit: [Jonathan Silverman][jsilver])
13
+ * [Rails] Update the gem dependencies for the rails installer template.
14
+ * If the configuration file changes, wipe out the sass cache and force compilation
15
+ * Upgrade the vendored version of FSSM to version 0.1.2.
16
+ Fixes some bugs with jruby and adds inotify support for linux.
17
+ (Credit: [Travis Tilley][ttilley])
18
+ * Patched hide-text to account for items that are not left aligned.
19
+ (Credit: [Josh Pyles][pixelmatrix])
20
+
21
+ Minor Enhancements:
22
+
23
+ * Support for SCSS files if haml edge is installed.
24
+ * Color any stderr or stdout output from the `Sass::Engine` red during compilation.
25
+ * [Configuration] The sass cache location can now be set in the compass config
26
+ file using the `cache_dir` property and the cache can be disabled by setting
27
+ `cache = false`.
28
+ * [Compass Core] `+min-height`, `+min-width`, and `+bang-hack` mixins in the
29
+ compass/utilities/general/min.sass module.
30
+ (Credit: [Adam Stacoviak][adamstac])
31
+ * [Command Line] If you only want to compile certain files, you can now
32
+ specify them when invoking compass compile. E.g. `compass compile src/foo.sass`
33
+ * [Compass Core] Split out `+hide-text` as its own mixin.
34
+ (Credit: [Andrew Vit][avit])
35
+ * Some code cleanup for the compass project compiler.
36
+ * Removed the dependency on RMagic for grid image generation.
37
+ (Credit: [Richard Wöber][der-rich])
38
+
4
39
  0.10.0.pre2 (November 30, 2009)
5
40
  --------------------------------
6
41
  Bug fixes:
@@ -729,3 +764,9 @@ Almost definitely. Please let me know if you encounter any problems and I'll get
729
764
  [rails_template]: http://github.com/chriseppstein/compass/raw/4e7e51e2c5491851f66c77abf3f15194f2f8fb8d/lib/compass/app_integration/rails/templates/compass-install-rails.rb
730
765
  [dturnbull]: http://github.com/dturnbull
731
766
  [filiptepper]: http://github.com/filiptepper
767
+ [pixelmatrix]: http://github.com/pixelmatrix
768
+ [jsilver]: http://github.com/jsilver
769
+ [avit]: http://github.com/avit
770
+ [der-rich]: http://github.com/der-rich
771
+ [adamstac]: http://github.com/adamstac
772
+ [ttilley]: http://github.com/ttilley
data/REVISION CHANGED
@@ -1 +1 @@
1
- 2465baba525421ac9cac1774d940f9e27971710d
1
+ 26b3efb3e6b7b8cabac5ae203bc3a590ab62d1b8
@@ -2,4 +2,4 @@
2
2
  :patch: 0
3
3
  :major: 0
4
4
  :minor: 10
5
- :build: pre2
5
+ :build: pre3
@@ -120,6 +120,26 @@ Feature: Command Line
120
120
  And a sass file sass/reset.sass is reported unchanged
121
121
  And a sass file sass/utilities.sass is reported unchanged
122
122
 
123
+ Scenario: compiling a specific file in a project
124
+ Given I am using the existing project in test/fixtures/stylesheets/compass
125
+ And I run: compass compile sass/utilities.sass
126
+ Then a sass file sass/layout.sass is not mentioned
127
+ And a sass file sass/print.sass is not mentioned
128
+ And a sass file sass/reset.sass is not mentioned
129
+ And a sass file sass/utilities.sass is reported compiled
130
+ And a css file tmp/utilities.css is reported created
131
+ And a css file tmp/utilities.css is created
132
+
133
+ Scenario: Re-compiling a specific file in a project with no changes
134
+ Given I am using the existing project in test/fixtures/stylesheets/compass
135
+ When I run: compass compile
136
+ And I run: compass compile sass/utilities.sass
137
+ Then a sass file sass/layout.sass is not mentioned
138
+ And a sass file sass/print.sass is not mentioned
139
+ And a sass file sass/reset.sass is not mentioned
140
+ And a sass file sass/utilities.sass is reported compiled
141
+ And a css file tmp/utilities.css is reported identical
142
+
123
143
  Scenario: Installing a pattern into a project
124
144
  Given I am using the existing project in test/fixtures/stylesheets/compass
125
145
  When I run: compass install blueprint/buttons
@@ -129,7 +149,6 @@ Feature: Command Line
129
149
  And an image file images/buttons/tick.png is created
130
150
  And a css file tmp/buttons.css is created
131
151
 
132
- @now
133
152
  Scenario: Basic help
134
153
  When I run: compass help
135
154
  Then I should see the following "primary" commands:
@@ -185,12 +204,14 @@ Feature: Command Line
185
204
  Given I am using the existing project in test/fixtures/stylesheets/compass
186
205
  When I run: compass grid-img 30+10x24
187
206
  Then a png file images/grid.png is created
207
+ And the image images/grid.png has a size of 40x24
188
208
 
189
209
  Scenario: Generating a grid image to a specified path with custom dimensions
190
210
  Given I am using the existing project in test/fixtures/stylesheets/compass
191
211
  When I run: compass grid-img 50+10x24 assets/wide_grid.png
192
212
  Then a directory assets is created
193
213
  Then a png file assets/wide_grid.png is created
214
+ And the image assets/wide_grid.png has a size of 60x24
194
215
 
195
216
  Scenario: Generating a grid image with invalid dimensions
196
217
  Given I am using the existing project in test/fixtures/stylesheets/compass
@@ -135,6 +135,10 @@ Then /a \w+ file ([^ ]+) is reported overwritten/ do |filename|
135
135
  @last_result.should =~ /overwrite #{Regexp.escape(filename)}/
136
136
  end
137
137
 
138
+ Then /a \w+ file ([^ ]+) is not mentioned/ do |filename|
139
+ @last_result.should_not =~ /#{Regexp.escape(filename)}/
140
+ end
141
+
138
142
  Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, media|
139
143
  @last_result.should =~ %r{<link href="#{stylesheet}" media="#{media}" rel="stylesheet" type="text/css" />}
140
144
  end
@@ -221,3 +225,10 @@ Then /^I should see the following "([^"]+)" commands:$/ do |kind, table|
221
225
  commands = @last_command_list.map{|c| c =~ /^\s+\* ([^ ]+)\s+- [A-Z].+$/; [$1]}
222
226
  table.diff!(commands)
223
227
  end
228
+
229
+
230
+ Then /^the image ([^ ]+) has a size of (\d+)x(\d+)$/ do |file, width, height|
231
+ # see http://snippets.dzone.com/posts/show/805
232
+ IO.read(file)[0x10..0x18].unpack('NN').should == [width.to_i, height.to_i]
233
+ end
234
+
@@ -63,24 +63,6 @@ module Compass
63
63
  ERB.new(contents).result(ctx)
64
64
  end
65
65
 
66
- # Compile one Sass file
67
- def compile(sass_filename, css_filename, options)
68
- if options[:force] || Sass::Plugin.exact_stylesheet_needs_update?(css_filename, sass_filename)
69
- logger.record :compile, basename(sass_filename) unless options[:quiet]
70
- engine = ::Sass::Engine.new(open(sass_filename).read,
71
- :filename => sass_filename,
72
- :line_comments => options[:line_comments],
73
- :style => options[:style],
74
- :css_filename => css_filename,
75
- :load_paths => options[:load_paths],
76
- :cache_location => options[:cache_location])
77
- css_content = engine.render
78
- write_file(css_filename, css_content, options.merge(:force => true))
79
- else
80
- logger.record :unchanged, basename(sass_filename) unless options[:quiet]
81
- end
82
- end
83
-
84
66
  def remove(file_name)
85
67
  if File.exists?(file_name)
86
68
  File.unlink file_name
@@ -36,7 +36,11 @@ module Compass
36
36
  end
37
37
 
38
38
  def default_extensions_dir
39
- "vendor/plugins/compass/extensions"
39
+ File.join("vendor", "plugins", "compass", "extensions")
40
+ end
41
+
42
+ def default_cache_dir
43
+ File.join("tmp", "sass-cache")
40
44
  end
41
45
 
42
46
  end
@@ -46,19 +46,28 @@ css_dir = ask("Where would you like Compass to store your compiled css files? (d
46
46
  css_dir = "public/stylesheets/compiled" if css_dir.blank?
47
47
 
48
48
  # define dependencies
49
- gem "haml", :lib => "haml", :version => ">=2.2.0"
50
- gem "chriseppstein-compass", :source => "http://gems.github.com/", :lib => "compass"
49
+ gem "haml", :version => ">=2.2.16"
50
+ gem "compass", :version => ">= 0.8.17"
51
51
 
52
52
  # install and unpack
53
- rake "gems:install GEM=haml", :sudo => true
54
- rake "gems:install GEM=chriseppstein-compass", :sudo => true
55
- rake "gems:unpack GEM=chriseppstein-compass"
53
+ unless RUBY_PLATFORM =~ /(win|w)32$/ # true if win32, cygwin or mingw32
54
+ rake "gems:install GEM=haml", :sudo => true
55
+ rake "gems:install GEM=compass", :sudo => true
56
+ else
57
+ rake "gems:install GEM=haml"
58
+ rake "gems:install GEM=compass"
59
+ end
60
+ rake "gems:unpack GEM=compass"
56
61
 
57
62
  # load any compass framework plugins
58
63
  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"
64
+ gem "compass-960-plugin", :lib => "ninesixty"
65
+ unless RUBY_PLATFORM =~ /(win|w)32$/
66
+ rake "gems:install GEM=compass-960-plugin", :sudo => true
67
+ else
68
+ rake "gems:install GEM=compass-960-plugin"
69
+ end
70
+ rake "gems:unpack GEM=compass-960-plugin"
62
71
  css_framework = "960" # rename for command
63
72
  plugin_require = "-r ninesixty"
64
73
  end
@@ -77,4 +86,4 @@ CODE
77
86
  run "haml --rails ."
78
87
  run compass_command
79
88
 
80
- puts "Compass (with #{css_framework}) is all setup, have fun!"
89
+ puts "Compass (with #{css_framework}) is all setup, have fun!"
@@ -21,6 +21,10 @@ module Compass
21
21
  def images_dir_without_default
22
22
  "images"
23
23
  end
24
+
25
+ def default_cache_dir
26
+ ".sass-cache"
27
+ end
24
28
  end
25
29
 
26
30
  end
@@ -80,11 +80,7 @@ Options:
80
80
  gutter_width = $2.to_i
81
81
  height = $3.to_i if $3
82
82
  filename = options[:grid_filename] || projectize("#{project_images_subdirectory}/grid.png")
83
- unless GridBuilder.new(options.merge(:column_width => column_width, :gutter_width => gutter_width, :height => height, :filename => filename, :working_path => self.working_path)).generate!
84
- puts "ERROR: Some library dependencies appear to be missing."
85
- puts "Have you installed rmagick? If not, please run:"
86
- puts "sudo gem install rmagick"
87
- end
83
+ GridBuilder.new(options.merge(:column_width => column_width, :gutter_width => gutter_width, :height => height, :filename => filename, :working_path => self.working_path)).generate!
88
84
  end
89
85
  end
90
86
  end
@@ -6,7 +6,7 @@ module Compass
6
6
  module CompileProjectOptionsParser
7
7
  def set_options(opts)
8
8
  opts.banner = %Q{
9
- Usage: compass compile [path/to/project] [options]
9
+ Usage: compass compile [path/to/project] [path/to/project/src/file.sass ...] [options]
10
10
 
11
11
  Description:
12
12
  compile project at the path specified or the current director if not specified.
@@ -47,9 +47,22 @@ module Compass
47
47
  projectize(Compass.configuration.sass_dir),
48
48
  projectize(Compass.configuration.css_dir),
49
49
  Compass.sass_engine_options.merge(:quiet => options[:quiet],
50
- :force => options[:force]).merge(additional_options))
50
+ :force => options[:force],
51
+ :sass_files => explicit_sass_files).merge(additional_options))
51
52
  end
52
53
 
54
+ def explicit_sass_files
55
+ return unless options[:sass_files]
56
+ options[:sass_files].map do |sass_file|
57
+ if absolute_path? sass_file
58
+ sass_file
59
+ else
60
+ File.join(Dir.pwd, sass_file)
61
+ end
62
+ end
63
+ end
64
+
65
+
53
66
  class << self
54
67
  def option_parser(arguments)
55
68
  parser = Compass::Exec::CommandOptionParser.new(arguments)
@@ -76,10 +89,12 @@ module Compass
76
89
  end
77
90
 
78
91
  def parse_arguments!(parser, arguments)
79
- if arguments.size == 1
80
- parser.options[:project_name] = arguments.shift
81
- elsif arguments.size > 1
82
- raise Compass::Error, "Too many arguments were specified."
92
+ if arguments.size > 0
93
+ parser.options[:project_name] = arguments.shift if File.directory?(arguments.first)
94
+ unless arguments.empty?
95
+ parser.options[:sass_files] = arguments.dup
96
+ parser.options[:force] = true
97
+ end
83
98
  end
84
99
  end
85
100
  end
@@ -10,12 +10,16 @@ module Compass
10
10
  self.from, self.to = from, to
11
11
  self.logger = options.delete(:logger)
12
12
  self.options = options
13
- self.options[:cache_location] ||= File.join(from, ".sass-cache")
13
+ self.options[:cache_location] ||= determine_cache_location
14
+ end
15
+
16
+ def determine_cache_location
17
+ Compass.configuration.cache_path || Sass::Plugin.options[:cache_location] || File.join(working_path, ".sass-cache")
14
18
  end
15
19
 
16
20
  def sass_files(options = {})
17
21
  exclude_partials = options.fetch(:exclude_partials, true)
18
- @sass_files || Dir.glob(separate("#{from}/**/#{'[^_]' if exclude_partials}*.sass"))
22
+ @sass_files = self.options[:sass_files] || Dir.glob(separate("#{from}/**/#{'[^_]' if exclude_partials}*.s[ac]ss"))
19
23
  end
20
24
 
21
25
  def stylesheet_name(sass_file)
@@ -34,6 +38,7 @@ module Compass
34
38
  css_files.map{|css_file| File.dirname(css_file)}.uniq.sort.sort_by{|d| d.length }
35
39
  end
36
40
 
41
+ # Returns the sass file that needs to be compiled, if any.
37
42
  def out_of_date?
38
43
  Compass.configure_sass_plugin! unless Compass.sass_plugin_configured?
39
44
  sass_files.zip(css_files).each do |sass_filename, css_filename|
@@ -42,26 +47,90 @@ module Compass
42
47
  false
43
48
  end
44
49
 
50
+ # Determines if the configuration file is newer than any css file
51
+ def new_config?
52
+ config_file = Compass.detect_configuration_file
53
+ return false unless config_file
54
+ config_mtime = File.mtime(config_file)
55
+ css_files.each do |css_filename|
56
+ return config_file if File.exists?(css_filename) && config_mtime > File.mtime(css_filename)
57
+ end
58
+ nil
59
+ end
60
+
45
61
  def run
46
- Compass.configure_sass_plugin! unless Compass.sass_plugin_configured?
47
- target_directories.each do |dir|
48
- directory dir
62
+ if new_config?
63
+ # Wipe out the cache and force compilation if the configuration has changed.
64
+ FileUtils.rm_rf options[:cache_location]
65
+ options[:force] = true
49
66
  end
67
+
68
+ # We use the Sass::Plugin to check dependencies so we have configure it.
69
+ Compass.configure_sass_plugin! unless Compass.sass_plugin_configured?
70
+
71
+ # Make sure the target directories exist
72
+ target_directories.each {|dir| directory dir}
73
+
74
+ # Compile each sass file.
50
75
  sass_files.zip(css_files).each do |sass_filename, css_filename|
51
76
  begin
52
- compile sass_filename, css_filename, options
77
+ compile_if_required sass_filename, css_filename
53
78
  rescue Sass::SyntaxError => e
54
- full_exception = Compass.configuration.environment == :development
55
- logger.record :error, basename(sass_filename), "(Line #{e.sass_line}: #{e.message})"
56
- contents = if Sass::SyntaxError.respond_to?(:exception_to_css)
57
- Sass::SyntaxError.exception_to_css(e, :full_exception => full_exception)
58
- else
59
- Sass::Plugin.options[:full_exception] ||= Compass.configuration.environment == :development
60
- Sass::Plugin.send(:exception_string, e)
61
- end
62
- write_file css_filename, contents, options.merge(:force => true)
79
+ handle_exception(sass_filename, css_filename, e)
63
80
  end
64
81
  end
65
82
  end
83
+
84
+ def compile_if_required(sass_filename, css_filename)
85
+ if should_compile?(sass_filename, css_filename)
86
+ compile sass_filename, css_filename
87
+ else
88
+ logger.record :unchanged, basename(sass_filename) unless options[:quiet]
89
+ end
90
+ end
91
+
92
+ # Compile one Sass file
93
+ def compile(sass_filename, css_filename)
94
+ logger.record :compile, basename(sass_filename) unless options[:quiet]
95
+ css_content = logger.red do
96
+ engine(sass_filename, css_filename).render
97
+ end
98
+ write_file(css_filename, css_content, options.merge(:force => true))
99
+ end
100
+
101
+ def should_compile?(sass_filename, css_filename)
102
+ options[:force] || Sass::Plugin.exact_stylesheet_needs_update?(css_filename, sass_filename)
103
+ end
104
+
105
+ # A sass engine for compiling a single file.
106
+ def engine(sass_filename, css_filename)
107
+ syntax = (sass_filename =~ /\.(s[ac]ss)$/) && $1.to_sym || :sass
108
+ opts = options.merge :filename => sass_filename, :css_filename => css_filename, :syntax => syntax
109
+ Sass::Engine.new(open(sass_filename).read, opts)
110
+ end
111
+
112
+ # Place the syntax error into the target css file,
113
+ # formatted to display in the browser (in development mode)
114
+ # if there's an error.
115
+ def handle_exception(sass_filename, css_filename, e)
116
+ logger.record :error, basename(sass_filename), "(Line #{e.sass_line}: #{e.message})"
117
+ write_file css_filename, error_contents(e), options.merge(:force => true)
118
+ end
119
+
120
+ # Haml refactored this logic in 2.3, this is backwards compatibility for either one
121
+ def error_contents(e)
122
+ if Sass::SyntaxError.respond_to?(:exception_to_css)
123
+ Sass::SyntaxError.exception_to_css(e, :full_exception => show_full_exception?)
124
+ else
125
+ Sass::Plugin.options[:full_exception] ||= show_full_exception?
126
+ Sass::Plugin.send(:exception_string, e)
127
+ end
128
+ end
129
+
130
+ # We don't want to show the full exception in production environments.
131
+ def show_full_exception?
132
+ Compass.configuration.environment == :development
133
+ end
134
+
66
135
  end
67
136
  end
@@ -29,6 +29,8 @@ module Compass
29
29
  :relative_assets,
30
30
  :additional_import_paths,
31
31
  :sass_options,
32
+ attributes_for_directory(:cache, nil),
33
+ :cache,
32
34
  # Helper configuration
33
35
  :asset_host,
34
36
  :asset_cache_buster,
@@ -19,6 +19,8 @@ module Compass
19
19
  plugin_opts = {:template_location => locations}
20
20
  plugin_opts[:style] = output_style if output_style
21
21
  plugin_opts[:line_comments] = line_comments
22
+ plugin_opts[:cache] = cache
23
+ plugin_opts[:cache_location] = cache_path
22
24
  plugin_opts.merge!(sass_options || {})
23
25
  plugin_opts
24
26
  end
@@ -42,6 +44,8 @@ module Compass
42
44
  engine_opts = {:load_paths => sass_load_paths}
43
45
  engine_opts[:style] = output_style if output_style
44
46
  engine_opts[:line_comments] = line_comments
47
+ engine_opts[:cache] = cache
48
+ engine_opts[:cache_location] = cache_path
45
49
  engine_opts.merge!(sass_options || {})
46
50
  end
47
51