-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
define the asset_url function in the right context.
- Loading branch information
1 parent
8d0462d
commit 9924af6
Showing
1 changed file
with
11 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'sprockets/sass_functions' | ||
begin | ||
require 'sprockets/sassc_processor' | ||
mod = Sprockets::SasscProcessor::Functions | ||
rescue LoadError | ||
require 'sprockets/sass_functions' | ||
mod = Sprockets::SassFunctions | ||
end | ||
|
||
module Sprockets | ||
module SassFunctions | ||
def asset_data_url(path) | ||
::SassC::Script::Value::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")") | ||
end | ||
mod.instance_eval do | ||
def asset_data_url(path) | ||
::SassC::Script::Value::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")") | ||
end | ||
end | ||
|
||
::SassC::Script::Functions.send :include, Sprockets::SassFunctions | ||
::SassC::Script::Functions.send :include, mod |