From fd058fae0491df44f47127756d3bd14ee5acd1be Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 1 Dec 2009 09:57:49 -0800 Subject: [PATCH] [Configuration] The sass cache location can now be set in the compass config file using the cache_dir property and the cache can be disabled by setting cache = false. --- .../app_integration/rails/configuration_defaults.rb | 6 +++++- .../stand_alone/configuration_defaults.rb | 4 ++++ lib/compass/configuration.rb | 2 ++ lib/compass/configuration/adapters.rb | 4 ++++ lib/compass/configuration/defaults.rb | 10 ++++++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/compass/app_integration/rails/configuration_defaults.rb b/lib/compass/app_integration/rails/configuration_defaults.rb index 0225cb07..c2537820 100644 --- a/lib/compass/app_integration/rails/configuration_defaults.rb +++ b/lib/compass/app_integration/rails/configuration_defaults.rb @@ -36,7 +36,11 @@ module Compass end def default_extensions_dir - "vendor/plugins/compass/extensions" + File.join("vendor", "plugins", "compass", "extensions") + end + + def default_cache_dir + File.join("tmp", "sass-cache") end end diff --git a/lib/compass/app_integration/stand_alone/configuration_defaults.rb b/lib/compass/app_integration/stand_alone/configuration_defaults.rb index 5eb364fa..230aeea1 100644 --- a/lib/compass/app_integration/stand_alone/configuration_defaults.rb +++ b/lib/compass/app_integration/stand_alone/configuration_defaults.rb @@ -21,6 +21,10 @@ module Compass def images_dir_without_default "images" end + + def default_cache_dir + ".sass-cache" + end end end diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index d25c1b68..ac4aaf7f 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -29,6 +29,8 @@ module Compass :relative_assets, :additional_import_paths, :sass_options, + attributes_for_directory(:cache, nil), + :cache, # Helper configuration :asset_host, :asset_cache_buster, diff --git a/lib/compass/configuration/adapters.rb b/lib/compass/configuration/adapters.rb index a43b7f5c..01929daf 100644 --- a/lib/compass/configuration/adapters.rb +++ b/lib/compass/configuration/adapters.rb @@ -19,6 +19,8 @@ module Compass plugin_opts = {:template_location => locations} plugin_opts[:style] = output_style if output_style plugin_opts[:line_comments] = line_comments + plugin_opts[:cache] = cache + plugin_opts[:cache_location] = cache_path plugin_opts.merge!(sass_options || {}) plugin_opts end @@ -42,6 +44,8 @@ module Compass engine_opts = {:load_paths => sass_load_paths} engine_opts[:style] = output_style if output_style engine_opts[:line_comments] = line_comments + engine_opts[:cache] = cache + engine_opts[:cache_location] = cache_path engine_opts.merge!(sass_options || {}) end diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb index d511d869..dadc0f39 100644 --- a/lib/compass/configuration/defaults.rb +++ b/lib/compass/configuration/defaults.rb @@ -74,6 +74,12 @@ module Compass end end + def default_cache_path + if (pp = top_level.project_path) && (dir = top_level.cache_dir) + File.join(pp, dir) + end + end + def default_http_images_dir top_level.images_dir @@ -111,6 +117,10 @@ module Compass http_root_relative top_level.http_javascripts_dir end + def default_cache + true + end + # helper functions def http_join(*segments)