diff --git a/lib/sassc/rails/template.rb b/lib/sassc/rails/template.rb index 53d7e59..e5cf6c7 100644 --- a/lib/sassc/rails/template.rb +++ b/lib/sassc/rails/template.rb @@ -79,6 +79,30 @@ def safe_merge(key, left, right) 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 + def asset_path(path, options = {}) + path = path.value + + path, _, query, fragment = URI.split(path)[5..8] + path = sprockets_context.asset_path(path, options) + query = "?#{query}" if query + fragment = "##{fragment}" if fragment + + ::SassC::Script::Value::String.new("#{path}#{query}#{fragment}", :string) + end + + def asset_url(path, options = {}) + ::SassC::Script::Value::String.new("url(#{asset_path(path, options).value})") + end + + def asset_data_url(path) + url = sprockets_context.asset_data_uri(path.value) + ::SassC::Script::Value::String.new("url(" + url + ")") + end + end end class ScssTemplate < SassTemplate diff --git a/test/sassc_rails_test.rb b/test/sassc_rails_test.rb index a427c4b..29265ce 100644 --- a/test/sassc_rails_test.rb +++ b/test/sassc_rails_test.rb @@ -87,9 +87,6 @@ def test_all_sass_asset_paths_work end def test_sass_asset_paths_work - # FIX before merging. this is causing segfault - skip - initialize! css_output = render_asset("helpers_test.css")