diff --git a/doc-src/content/tutorials/configuration-reference.markdown b/doc-src/content/tutorials/configuration-reference.markdown
index d3a2d1f2..d62b89b7 100644
--- a/doc-src/content/tutorials/configuration-reference.markdown
+++ b/doc-src/content/tutorials/configuration-reference.markdown
@@ -108,6 +108,18 @@ command line will override the corresponding settings in your configuration file
Defaults to "stylesheets"
.
+
+ css_path |
+ String |
+ The full path to where css stylesheets are kept.
+ Defaults to <project_path>/<css_dir> .
+ |
+
+
+ http_stylesheets_path |
+ String |
+ The full http path to stylesheets on the web server. Defaults to http_path + "/" + css_dir . |
+
sass_dir |
String |
@@ -115,6 +127,13 @@ command line will override the corresponding settings in your configuration file
It is relative to the project_path
. Defaults to "src"
.
+
+ sass_path |
+ String |
+ The full path to where sass stylesheets are kept.
+ Defaults to <project_path>/<sass_dir> .
+ |
+
images_dir |
String |
@@ -123,6 +142,20 @@ command line will override the corresponding settings in your configuration file
Defaults to "images"
.
+
+ images_path |
+ String |
+ The full path to where images are kept.
+ Defaults to <project_path>/<images_dir> .
+ |
+
+
+ http_images_path |
+ String |
+ The full http path to images on the web server.
+ Defaults to http_path + "/" + images_dir .
+ |
+
javascripts_dir |
String |
@@ -131,6 +164,20 @@ command line will override the corresponding settings in your configuration file
"javascripts"
.
+
+ javascripts_path |
+ String |
+ The full path to where javascripts are kept.
+ Defaults to <project_path>/<javascripts_dir> .
+ |
+
+
+ http_javascripts_path |
+ String |
+ The full http path to javascripts on the web server.
+ Defaults to http_path + "/" + javascripts_dir .
+ |
+
output_style |
Symbol |
@@ -147,25 +194,6 @@ command line will override the corresponding settings in your configuration file
using the http path for that asset type.
-
- http_images_path |
- String |
- The full http path to images on the web server.
- Defaults to http_path + "/" + images_dir .
- |
-
-
- http_stylesheets_path |
- String |
- The full http path to stylesheets on the web server. Defaults to http_path + "/" + css_dir . |
-
-
- http_javascripts_path |
- String |
- The full http path to javascripts on the web server.
- Defaults to http_path + "/" + javascripts_dir .
- |
-
additional_import_paths |
Array of Strings |
diff --git a/lib/compass/commands/update_project.rb b/lib/compass/commands/update_project.rb
index 24ebb190..1d84185e 100644
--- a/lib/compass/commands/update_project.rb
+++ b/lib/compass/commands/update_project.rb
@@ -53,8 +53,8 @@ module Compass
:dry_run => options[:dry_run])
compiler_opts.merge!(additional_options)
Compass::Compiler.new(working_path,
- projectize(Compass.configuration.sass_dir),
- projectize(Compass.configuration.css_dir),
+ Compass.configuration.sass_path,
+ Compass.configuration.css_path,
compiler_opts)
end
diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb
index 73e54da7..db63bd3e 100644
--- a/lib/compass/configuration/defaults.rb
+++ b/lib/compass/configuration/defaults.rb
@@ -44,43 +44,43 @@ module Compass
def default_sass_path
if (pp = top_level.project_path) && (dir = top_level.sass_dir)
- File.join(pp, dir)
+ Compass.projectize(dir, pp)
end
end
def default_css_path
if (pp = top_level.project_path) && (dir = top_level.css_dir)
- File.join(pp, dir)
+ Compass.projectize(dir, pp)
end
end
def default_images_path
if (pp = top_level.project_path) && (dir = top_level.images_dir)
- File.join(pp, dir)
+ Compass.projectize(dir, pp)
end
end
def default_javascripts_path
if (pp = top_level.project_path) && (dir = top_level.javascripts_dir)
- File.join(pp, dir)
+ Compass.projectize(dir, pp)
end
end
def default_extensions_path
if (pp = top_level.project_path) && (dir = top_level.extensions_dir)
- File.join(pp, dir)
+ Compass.projectize(dir, pp)
end
end
def default_fonts_path
if (pp = top_level.project_path) && (dir = top_level.fonts_dir)
- File.join(pp, dir)
+ Compass.projectize(dir, pp)
end
end
def default_cache_path
if (pp = top_level.project_path) && (dir = top_level.cache_dir)
- File.join(pp, dir)
+ Compass.projectize(dir, pp)
end
end
diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb
index 08b15e8e..0d49b8e7 100644
--- a/lib/compass/exec.rb
+++ b/lib/compass/exec.rb
@@ -6,6 +6,7 @@ require 'compass/actions'
require 'compass/installers'
require 'compass/commands'
require 'rbconfig'
+require 'pathname'
begin
require 'win32console' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
rescue LoadError
diff --git a/lib/compass/exec/project_options_parser.rb b/lib/compass/exec/project_options_parser.rb
index 2209353b..571e200e 100644
--- a/lib/compass/exec/project_options_parser.rb
+++ b/lib/compass/exec/project_options_parser.rb
@@ -3,6 +3,14 @@ module Compass::Exec::ProjectOptionsParser
super
set_project_options(opts)
end
+ def set_dir_or_path(type, dir)
+ if Pathname.new(dir).absolute?
+ self.options[:"#{type}_path"] = dir.tr('\\','/')
+ else
+ self.options[:"#{type}_dir"] = dir.tr('\\','/')
+ end
+ end
+
def set_project_options(opts)
opts.on('-c', '--config CONFIG_FILE', 'Specify the location of the configuration file explicitly.') do |configuration_file|
self.options[:configuration_file] = configuration_file
@@ -13,19 +21,19 @@ module Compass::Exec::ProjectOptionsParser
end
opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir|
- self.options[:sass_dir] = sass_dir.tr('\\','/')
+ set_dir_or_path(:sass, sass_dir)
end
opts.on('--css-dir CSS_DIR', "The target directory where you keep your css stylesheets.") do |css_dir|
- self.options[:css_dir] = css_dir.tr('\\','/')
+ set_dir_or_path(:css, css_dir)
end
opts.on('--images-dir IMAGES_DIR', "The directory where you keep your images.") do |images_dir|
- self.options[:images_dir] = images_dir.tr('\\','/')
+ set_dir_or_path(:images, images_dir)
end
opts.on('--javascripts-dir JS_DIR', "The directory where you keep your javascripts.") do |javascripts_dir|
- self.options[:javascripts_dir] = javascripts_dir.tr('\\','/')
+ set_dir_or_path(:javascripts, javascripts_dir)
end
opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment.',
diff --git a/lib/compass/sass_extensions/functions/urls.rb b/lib/compass/sass_extensions/functions/urls.rb
index 85754d37..615c4a91 100644
--- a/lib/compass/sass_extensions/functions/urls.rb
+++ b/lib/compass/sass_extensions/functions/urls.rb
@@ -4,7 +4,7 @@ module Compass::SassExtensions::Functions::Urls
# Compute the path to the stylesheet, either root relative or stylesheet relative
# or nil if the http_images_path is not set in the configuration.
http_stylesheets_path = if relative?
- compute_relative_path(Compass.configuration.css_dir)
+ compute_relative_path(Compass.configuration.css_path)
elsif Compass.configuration.http_stylesheets_path
Compass.configuration.http_stylesheets_path
else
@@ -30,7 +30,7 @@ module Compass::SassExtensions::Functions::Urls
# Compute the path to the font file, either root relative or stylesheet relative
# or nil if the http_fonts_path cannot be determined from the configuration.
http_fonts_path = if relative?
- compute_relative_path(Compass.configuration.fonts_dir)
+ compute_relative_path(Compass.configuration.fonts_path)
else
Compass.configuration.http_fonts_path
end
@@ -59,7 +59,7 @@ module Compass::SassExtensions::Functions::Urls
# Compute the path to the image, either root relative or stylesheet relative
# or nil if the http_images_path is not set in the configuration.
http_images_path = if relative?
- compute_relative_path(Compass.configuration.images_dir)
+ compute_relative_path(Compass.configuration.images_path)
elsif Compass.configuration.http_images_path
Compass.configuration.http_images_path
else
@@ -118,9 +118,8 @@ module Compass::SassExtensions::Functions::Urls
path[0..0] == "/" || path[0..3] == "http"
end
- def compute_relative_path(dir)
+ def compute_relative_path(path)
if (target_css_file = options[:css_filename])
- path = File.join(Compass.configuration.project_path, dir)
Pathname.new(path).relative_path_from(Pathname.new(File.dirname(target_css_file))).to_s
end
end