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
59
59
For example: ` image_url("rails.png") ` becomes ` url(/assets/rails.png) ` and
60
60
` image_path("rails.png") ` becomes ` "/assets/rails.png" ` .
61
61
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...) `
62
64
63
65
## Running Tests
64
66
Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ module Sass
2
2
module Rails
3
3
module Helpers
4
4
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
+
5
10
def asset_path ( asset , kind )
6
11
Sass ::Script ::String . new ( public_path ( asset . value , kind . value ) , true )
7
12
end
@@ -25,6 +30,10 @@ def #{asset_class}_url(asset)
25
30
def public_path ( asset , kind )
26
31
options [ :custom ] [ :resolver ] . public_path ( asset , kind . pluralize )
27
32
end
33
+
34
+ def context_asset_data_uri ( path )
35
+ options [ :custom ] [ :resolver ] . context . asset_data_uri ( path )
36
+ end
28
37
end
29
38
end
30
39
end
You can’t perform that action at this time.
0 commit comments