Added support for a fonts directory. This is where font files are kept
and should be accessible to the webserver. By default the fonts directory is the "fonts" subdirectory of the css directory but another location can be set via the fonts_dir and http_fonts_dir configuration options.
This commit is contained in:
parent
d2c314839d
commit
070f39c6b7
@ -1,26 +1,29 @@
|
|||||||
module Compass
|
module Compass
|
||||||
module Configuration
|
module Configuration
|
||||||
|
|
||||||
|
def self.attributes_for_directory(dir_name, http_dir_name = dir_name)
|
||||||
|
[
|
||||||
|
"#{dir_name}_dir",
|
||||||
|
"#{dir_name}_path",
|
||||||
|
("http_#{http_dir_name}_dir" if http_dir_name),
|
||||||
|
("http_#{http_dir_name}_path" if http_dir_name)
|
||||||
|
].compact.map{|a| a.to_sym}
|
||||||
|
end
|
||||||
|
|
||||||
ATTRIBUTES = [
|
ATTRIBUTES = [
|
||||||
|
# What kind of project?
|
||||||
:project_type,
|
:project_type,
|
||||||
|
# Where is the project?
|
||||||
:project_path,
|
:project_path,
|
||||||
:css_dir,
|
|
||||||
:sass_dir,
|
|
||||||
:images_dir,
|
|
||||||
:javascripts_dir,
|
|
||||||
:extensions_dir,
|
|
||||||
:css_path,
|
|
||||||
:sass_path,
|
|
||||||
:images_path,
|
|
||||||
:javascripts_path,
|
|
||||||
:extensions_path,
|
|
||||||
:http_path,
|
:http_path,
|
||||||
:http_images_dir,
|
# Where are the various bits of the project
|
||||||
:http_stylesheets_dir,
|
attributes_for_directory(:css, :stylesheets),
|
||||||
:http_javascripts_dir,
|
attributes_for_directory(:sass, nil),
|
||||||
:http_images_path,
|
attributes_for_directory(:images),
|
||||||
:http_stylesheets_path,
|
attributes_for_directory(:javascripts),
|
||||||
:http_javascripts_path,
|
attributes_for_directory(:fonts),
|
||||||
|
attributes_for_directory(:extensions, nil),
|
||||||
|
# Compilation options
|
||||||
:output_style,
|
:output_style,
|
||||||
:environment,
|
:environment,
|
||||||
:relative_assets,
|
:relative_assets,
|
||||||
@ -28,7 +31,7 @@ module Compass
|
|||||||
:sass_options,
|
:sass_options,
|
||||||
:asset_host,
|
:asset_host,
|
||||||
:asset_cache_buster
|
:asset_cache_buster
|
||||||
]
|
].flatten
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -14,6 +14,10 @@ module Compass
|
|||||||
"extensions"
|
"extensions"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_fonts_dir
|
||||||
|
File.join(top_level.css_dir, "fonts")
|
||||||
|
end
|
||||||
|
|
||||||
def default_output_style
|
def default_output_style
|
||||||
if top_level.environment == :development
|
if top_level.environment == :development
|
||||||
:expanded
|
:expanded
|
||||||
@ -56,6 +60,12 @@ module Compass
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_fonts_path
|
||||||
|
if (pp = top_level.project_path) && (dir = top_level.fonts_dir)
|
||||||
|
File.join(pp, dir)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def default_http_images_dir
|
def default_http_images_dir
|
||||||
top_level.images_dir
|
top_level.images_dir
|
||||||
@ -73,6 +83,18 @@ module Compass
|
|||||||
http_root_relative top_level.http_stylesheets_dir
|
http_root_relative top_level.http_stylesheets_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_http_fonts_dir
|
||||||
|
if fd = top_level.fonts_dir_without_default
|
||||||
|
fd
|
||||||
|
else
|
||||||
|
"#{top_level.http_stylesheets_dir}/fonts"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def default_http_fonts_path
|
||||||
|
http_root_relative top_level.http_fonts_dir
|
||||||
|
end
|
||||||
|
|
||||||
def default_http_javascripts_dir
|
def default_http_javascripts_dir
|
||||||
top_level.javascripts_dir
|
top_level.javascripts_dir
|
||||||
end
|
end
|
||||||
|
@ -15,12 +15,12 @@ class ConfigurationTest < Test::Unit::TestCase
|
|||||||
# Require any additional compass plugins here.
|
# Require any additional compass plugins here.
|
||||||
|
|
||||||
project_type = :stand_alone
|
project_type = :stand_alone
|
||||||
|
# Set this to the root of your project when deployed:
|
||||||
|
http_path = "/"
|
||||||
css_dir = "css"
|
css_dir = "css"
|
||||||
sass_dir = "sass"
|
sass_dir = "sass"
|
||||||
images_dir = "img"
|
images_dir = "img"
|
||||||
javascripts_dir = "js"
|
javascripts_dir = "js"
|
||||||
# Set this to the root of your project when deployed:
|
|
||||||
http_path = "/"
|
|
||||||
output_style = :nested
|
output_style = :nested
|
||||||
# To enable relative paths to assets via compass helper functions. Uncomment:
|
# To enable relative paths to assets via compass helper functions. Uncomment:
|
||||||
# relative_assets = true
|
# relative_assets = true
|
||||||
@ -87,9 +87,9 @@ class ConfigurationTest < Test::Unit::TestCase
|
|||||||
expected_serialization = <<EXPECTED
|
expected_serialization = <<EXPECTED
|
||||||
# Require any additional compass plugins here.
|
# Require any additional compass plugins here.
|
||||||
project_path = "/home/chris/my_compass_project"
|
project_path = "/home/chris/my_compass_project"
|
||||||
css_dir = "css"
|
|
||||||
# Set this to the root of your project when deployed:
|
# Set this to the root of your project when deployed:
|
||||||
http_path = "/"
|
http_path = "/"
|
||||||
|
css_dir = "css"
|
||||||
# To enable relative paths to assets via compass helper functions. Uncomment:
|
# To enable relative paths to assets via compass helper functions. Uncomment:
|
||||||
# relative_assets = true
|
# relative_assets = true
|
||||||
additional_import_paths = ["../foo", "/path/to/my/framework"]
|
additional_import_paths = ["../foo", "/path/to/my/framework"]
|
||||||
|
Loading…
Reference in New Issue
Block a user