compass_sumo 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,9 +3,9 @@ require 'uri'
|
|
3
3
|
module CompassSumo::SassExtensions::Functions::InlineSvg
|
4
4
|
def inline_svg(path)
|
5
5
|
data = svg_content(path.value)
|
6
|
-
data = URI.escape(data, '()#') # URL escape breaking characters
|
7
|
-
|
8
|
-
|
6
|
+
data = URI.escape(data, '()#'). # URL escape breaking characters
|
7
|
+
split(/[\r\n]+/). # Get rid of newlines in the URL
|
8
|
+
join.gsub(/\t/, '') # Get rid of tabs.
|
9
9
|
|
10
10
|
url = "url('data:image/svg+xml;utf-8,#{data}')"
|
11
11
|
Sass::Script::String.new(url)
|
data/lib/compass_sumo/version.rb
CHANGED
@@ -19,11 +19,12 @@
|
|
19
19
|
$defaultSvgFallbackClass: 'no-svg' !default;
|
20
20
|
|
21
21
|
// Setup a SVG background with PNG fallback
|
22
|
-
@mixin svg-with-png-fallback($name, $backgroundOptions:
|
22
|
+
@mixin svg-with-png-fallback($name, $backgroundOptions: null,
|
23
23
|
$svgImage: null,
|
24
24
|
$pngImage: null,
|
25
25
|
$fallbackClass: $defaultSvgFallbackClass,
|
26
|
-
$inline: true
|
26
|
+
$inline: true,
|
27
|
+
$dimensions: true
|
27
28
|
) {
|
28
29
|
|
29
30
|
$svgImage: "#{$name}.svg" !default;
|
@@ -31,8 +32,15 @@ $defaultSvgFallbackClass: 'no-svg' !default;
|
|
31
32
|
|
32
33
|
@if ($inline) {
|
33
34
|
@include background(inline-image($svgImage) #{$backgroundOptions});
|
35
|
+
background-size: image-width($pngImage) auto;
|
34
36
|
} @else {
|
35
37
|
@include background(image-url($svgImage) #{$backgroundOptions});
|
38
|
+
background-size: image-width($pngImage) auto;
|
39
|
+
}
|
40
|
+
|
41
|
+
@if ($dimensions) {
|
42
|
+
width: image-width($pngImage);
|
43
|
+
height: image-height($pngImage);
|
36
44
|
}
|
37
45
|
|
38
46
|
@include fallback($fallbackClass) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compass_sumo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-03-
|
14
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: compass
|