def self.normalize_options(options)
options = DEFAULT_OPTIONS.merge(options.reject {|_k, v| v.nil?})
options[:importer] ||= options[:filesystem_importer].new(".") if options[:filename]
options[:original_filename] ||= options[:filename]
options[:cache_store] ||= Sass::CacheStores::Chain.new(
Sass::CacheStores::Memory.new, Sass::CacheStores::Filesystem.new(options[:cache_location]))
options[:line_comments] ||= options[:line_numbers]
options[:load_paths] = (options[:load_paths] + Sass.load_paths).map do |p|
next p unless p.is_a?(String) || (defined?(Pathname) && p.is_a?(Pathname))
options[:filesystem_importer].new(p.to_s)
end
options[:load_paths].reject! do |importer|
importer.is_a?(Sass::Importers::DeprecatedPath) &&
options[:load_paths].find do |other_importer|
other_importer.is_a?(Sass::Importers::Filesystem) &&
other_importer != importer &&
other_importer.root == importer.root
end
end
options[:property_syntax] ||= options[:attribute_syntax]
case options[:property_syntax]
when :alternate; options[:property_syntax] = :new
when :normal; options[:property_syntax] = :old
end
options[:sourcemap] = :auto if options[:sourcemap] == true
options[:sourcemap] = :none if options[:sourcemap] == false
options
end