From 389291958516adf695e274b81dab16a3c12cb2cc Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 1 Apr 2011 09:00:33 -0700 Subject: [PATCH] Raise an error when compiling selective files from a directory other than the project directory. --- lib/compass/compiler.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/compass/compiler.rb b/lib/compass/compiler.rb index 837b3dab..5ee4d542 100644 --- a/lib/compass/compiler.rb +++ b/lib/compass/compiler.rb @@ -26,11 +26,15 @@ module Compass end def relative_stylesheet_name(sass_file) - sass_file[("#{from}/".length)..-1] + sass_file[(from.length + 1)..-1] end def stylesheet_name(sass_file) - sass_file.gsub(%r{#{from}/}, '')[0..-6] + if sass_file.index(from) == 0 + sass_file[(from.length + 1)..-6] + else + raise Compass::Error, "You must compile individual stylesheets from the project directory." + end end def css_files