Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: test #127

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions lib/sassc/rails/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def call(input)
environment: input[:environment],
dependencies: context.metadata[:dependency_paths]
}
}.merge!(config_options) { |key, left, right| safe_merge(key, left, right) }
}.merge!(config_options)

if load_paths
options[:load_paths] += load_paths
end

engine = ::SassC::Engine.new(input[:data], options)

Expand All @@ -44,7 +48,7 @@ def call(input)
end

def config_options
opts = { style: sass_style, load_paths: load_paths }
opts = { style: sass_style }


if Rails.application.config.sass.inline_source_maps
Expand All @@ -63,23 +67,13 @@ def sass_style
end

def load_paths
Rails.application.config.sass.load_paths || []
Rails.application.config.sass.load_paths
end

def line_comments?
Rails.application.config.sass.line_comments
end

def safe_merge(_key, left, right)
if [left, right].all? { |v| v.is_a? Hash }
left.merge(right) { |k, l, r| safe_merge(k, l, r) }
elsif [left, right].all? { |v| v.is_a? Array }
(left + right).uniq
else
right
end
end

# The methods in the Functions module were copied here from sprockets in order to
# override the Value class names (e.g. ::SassC::Script::Value::String)
module Functions
Expand Down