Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

mohammad/fix_svg_ie #1485

Merged
merged 5 commits into from
Sep 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/stylelint.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
'!src/sass/external/**/*.scss',
'!src/sass/_constants.scss',
'!src/sass/mixin.scss',
'!src/sass/functions.scss',
'!src/sass/reset.scss'
]
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/compile.pl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}

if ($pattern) {
@m = grep {index($_->[0], $pattern) > -1} @m;
@m = grep {$_->[0] =~ $pattern} @m;
$force = 1;
# use the last hash to maintain consistency between current templates with new one
# since pattern specified, so one or few templates are going to be compiled not all of them
Expand Down
1 change: 1 addition & 0 deletions src/sass/all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* common styles */
@import 'reset';
@import 'mixin';
@import 'functions';
@import 'common';
@import 'animations';

Expand Down
2 changes: 1 addition & 1 deletion src/sass/common/accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
background-position: left !important;
}
h3.ui-state-default {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><defs><style>.cls-1{fill:#{rgba($COLOR_BLUE, 1)};}</style></defs><title>arrow_left</title><path class="cls-1" d="M15.7,16.59,11.125,12,15.7,7.41,14.3,6l-6,6,6,6Z"/></svg>');
background-image: svg-url('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="#{rgba($COLOR_BLUE, 1)}" d="M15.7,16.59,11.125,12,15.7,7.41,14.3,6l-6,6,6,6Z"/></svg>');
}
}
.ui-accordion-content {
Expand Down
37 changes: 37 additions & 0 deletions src/sass/functions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* To replace characters in a string
*/
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace +
str-replace(str-slice($string, $index +
str-length($search)), $search, $replace);
}
@return $string;
}

/*
* To create an optimized svg url
*/
@function svg-url($svg) {
/*
* Chunk up string in order to avoid
* "SystemStackError: stack level too deep"
*/
$encoded: '';
$slice: 2000;
$index: 0;
$loops: ceil(str-length($svg)/$slice);
@for $i from 1 through $loops {
$chunk: str-slice($svg, $index, $index + $slice - 1);
$chunk: str-replace($chunk,'"','\'');
$chunk: str-replace($chunk,'<','%3C');
$chunk: str-replace($chunk,'>','%3E');
$chunk: str-replace($chunk,'&','%26');
$chunk: str-replace($chunk,'#','%23');
$encoded: #{$encoded}#{$chunk};
$index: $index + $slice;
}
@return url("data:image/svg+xml;charset=utf8,#{$encoded}");
}