File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ The [list of supported options](http://sass-lang.com/docs/yardoc/file.SASS_REFER
5959 For example: ` image_url("rails.png") ` becomes ` url(/assets/rails.png) ` and
6060 ` image_path("rails.png") ` becomes ` "/assets/rails.png" ` .
6161
62+ * ` asset_data_url($relative-asset-path) ` - Returns url reference to the Base64-encoded asset at the specified path.
63+ For example: ` asset-data-url("rails.png") ` becomes ` url(data:image/png;base64,iVBORw0K...) `
6264
6365## Running Tests
6466
Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ module Sass
22 module Rails
33 module Helpers
44
5+ def asset_data_url ( path )
6+ data = context_asset_data_uri ( path . value )
7+ Sass ::Script ::String . new ( %Q{url(#{ data } )} )
8+ end
9+
510 def asset_path ( asset , kind )
611 Sass ::Script ::String . new ( public_path ( asset . value , kind . value ) , true )
712 end
@@ -25,6 +30,10 @@ def #{asset_class}_url(asset)
2530 def public_path ( asset , kind )
2631 options [ :custom ] [ :resolver ] . public_path ( asset , kind . pluralize )
2732 end
33+
34+ def context_asset_data_uri ( path )
35+ options [ :custom ] [ :resolver ] . context . asset_data_uri ( path )
36+ end
2837 end
2938 end
3039end
You can’t perform that action at this time.
0 commit comments