FIX: missing image-url helper

This commit is contained in:
Sam 2017-05-01 15:31:51 -04:00
parent ee3d4f2a27
commit ba9339b8d7
2 changed files with 11 additions and 1 deletions

View File

@ -1,7 +1,10 @@
module Stylesheet
module ScssFunctions
def asset_url(path)
SassC::Script::String.new("url('#{ActionController::Base.helpers.asset_path(path.value)}')")
SassC::Script::String.new("url('#{ActionController::Base.helpers.asset_url(path.value)}')")
end
def image_url(path)
SassC::Script::String.new("url('#{ActionController::Base.helpers.image_url(path.value)}')")
end
end
end

View File

@ -16,6 +16,13 @@ describe Stylesheet::Compiler do
expect(css).to include("url('/foo.png')")
expect(css).not_to include('asset-url')
end
it "supports image-url" do
css,_map = Stylesheet::Compiler.compile(".body{background-image: image-url('foo.png');}","test.scss")
expect(css).to include("url('/images/foo.png')")
expect(css).not_to include('image-url')
end
end