Skip to content

Commit c314d1c

Browse files
committed
override function methods to use appropriate value classes
1 parent 3dd4127 commit c314d1c

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

lib/sassc/rails/template.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,30 @@ def safe_merge(key, left, right)
7979
right
8080
end
8181
end
82+
83+
# The methods in the Functions module were copied here from sprockets in order to
84+
# override the Value class names (e.g. ::SassC::Script::Value::String)
85+
module Functions
86+
def asset_path(path, options = {})
87+
path = path.value
88+
89+
path, _, query, fragment = URI.split(path)[5..8]
90+
path = sprockets_context.asset_path(path, options)
91+
query = "?#{query}" if query
92+
fragment = "##{fragment}" if fragment
93+
94+
::SassC::Script::Value::String.new("#{path}#{query}#{fragment}", :string)
95+
end
96+
97+
def asset_url(path, options = {})
98+
::SassC::Script::Value::String.new("url(#{asset_path(path, options).value})")
99+
end
100+
101+
def asset_data_url(path)
102+
url = sprockets_context.asset_data_uri(path.value)
103+
::SassC::Script::Value::String.new("url(" + url + ")")
104+
end
105+
end
82106
end
83107

84108
class ScssTemplate < SassTemplate

test/sassc_rails_test.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ def test_all_sass_asset_paths_work
8787
end
8888

8989
def test_sass_asset_paths_work
90-
# FIX before merging. this is causing segfault
91-
skip
92-
9390
initialize!
9491

9592
css_output = render_asset("helpers_test.css")

0 commit comments

Comments
 (0)