Module: Compass::Configuration::Adapters
- Included in:
- Data
- Defined in:
- lib/compass/configuration/adapters.rb
Overview
The adapters module provides methods that make configuration data from a compass project adapt to various consumers of configuration data
Instance Method Summary collapse
- #absolute_path?(path) ⇒ Boolean
- #resolve_additional_import_paths ⇒ Object
- #sass_load_paths ⇒ Object
- #to_compiler_arguments(additional_options) ⇒ Object
- #to_sass_engine_options ⇒ Object
- #to_sass_plugin_options ⇒ Object
Instance Method Details
#absolute_path?(path) ⇒ Boolean
36 37 38 39 |
# File 'lib/compass/configuration/adapters.rb', line 36 def absolute_path?(path) # This is only going to work on unix, gonna need a better implementation. path.index(File::SEPARATOR) == 0 end |
#resolve_additional_import_paths ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/compass/configuration/adapters.rb', line 26 def resolve_additional_import_paths (additional_import_paths || []).map do |path| if project_path && !absolute_path?(path) File.join(project_path, path) else path end end end |
#sass_load_paths ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/compass/configuration/adapters.rb', line 48 def sass_load_paths load_paths = [] load_paths << sass_path if sass_path Compass::Frameworks::ALL.each do |framework| load_paths << framework.stylesheets_directory if File.exists?(framework.stylesheets_directory) end load_paths += resolve_additional_import_paths load_paths end |
#to_compiler_arguments(additional_options) ⇒ Object
6 7 8 |
# File 'lib/compass/configuration/adapters.rb', line 6 def to_compiler_arguments() [project_path, sass_path, css_path, .merge()] end |
#to_sass_engine_options ⇒ Object
41 42 43 44 45 46 |
# File 'lib/compass/configuration/adapters.rb', line 41 def engine_opts = {:load_paths => sass_load_paths} engine_opts[:style] = output_style if output_style engine_opts[:line_comments] = line_comments if environment engine_opts.merge!( || {}) end |
#to_sass_plugin_options ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/compass/configuration/adapters.rb', line 10 def locations = {} locations[sass_path] = css_path if sass_path && css_path Compass::Frameworks::ALL.each do |framework| locations[framework.stylesheets_directory] = css_path || css_dir || "." end resolve_additional_import_paths.each do |additional_path| locations[additional_path] = File.join(css_path || css_dir || ".", File.basename(additional_path)) end plugin_opts = {:template_location => locations} plugin_opts[:style] = output_style if output_style plugin_opts[:line_comments] = line_comments if environment plugin_opts.merge!( || {}) plugin_opts end |