Skip to content

Commit 9924af6

Browse files
define the asset_url function in the right context.
1 parent 8d0462d commit 9924af6

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/sassc/rails/functions.rb

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# frozen_string_literal: true
22

3-
require 'sprockets/sass_functions'
3+
begin
4+
require 'sprockets/sassc_processor'
5+
mod = Sprockets::SasscProcessor::Functions
6+
rescue LoadError
7+
require 'sprockets/sass_functions'
8+
mod = Sprockets::SassFunctions
9+
end
410

5-
module Sprockets
6-
module SassFunctions
7-
def asset_data_url(path)
8-
::SassC::Script::Value::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
9-
end
11+
mod.instance_eval do
12+
def asset_data_url(path)
13+
::SassC::Script::Value::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
1014
end
1115
end
1216

13-
::SassC::Script::Functions.send :include, Sprockets::SassFunctions
17+
::SassC::Script::Functions.send :include, mod

0 commit comments

Comments
 (0)