Skip to content

Commit 2e15e66

Browse files
committed
Fix "$a-$b" -> "#{$a}-#{$b}" conversion
1 parent 8c0b5db commit 2e15e66

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

assets/stylesheets/bootstrap/_glyphicons.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
// Import the fonts
1212
@font-face {
1313
font-family: "Glyphicons Halflings";
14-
src: url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{#{$icon-font-name}}.eot"), "#{$icon-font-path}#{#{$icon-font-name}}.eot"));
15-
src: url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{#{$icon-font-name}}.eot?#iefix"), "#{$icon-font-path}#{#{$icon-font-name}}.eot?#iefix")) format("embedded-opentype"),
16-
url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{#{$icon-font-name}}.woff2"), "#{$icon-font-path}#{#{$icon-font-name}}.woff2")) format("woff2"),
17-
url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{#{$icon-font-name}}.woff"), "#{$icon-font-path}#{#{$icon-font-name}}.woff")) format("woff"),
18-
url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{#{$icon-font-name}}.ttf"), "#{$icon-font-path}#{#{$icon-font-name}}.ttf")) format("truetype"),
19-
url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{$icon-font-name}.svg##{#{$icon-font-svg-id}}"), "#{$icon-font-path}#{$icon-font-name}.svg##{#{$icon-font-svg-id}}")) format("svg");
14+
src: url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{$icon-font-name}.eot"), "#{$icon-font-path}#{$icon-font-name}.eot"));
15+
src: url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{$icon-font-name}.eot?#iefix"), "#{$icon-font-path}#{$icon-font-name}.eot?#iefix")) format("embedded-opentype"),
16+
url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{$icon-font-name}.woff2"), "#{$icon-font-path}#{$icon-font-name}.woff2")) format("woff2"),
17+
url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{$icon-font-name}.woff"), "#{$icon-font-path}#{$icon-font-name}.woff")) format("woff"),
18+
url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{$icon-font-name}.ttf"), "#{$icon-font-path}#{$icon-font-name}.ttf")) format("truetype"),
19+
url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{$icon-font-name}.svg##{$icon-font-svg-id}"), "#{$icon-font-path}#{$icon-font-name}.svg##{$icon-font-svg-id}")) format("svg");
2020
}
2121
}
2222

tasks/converter/less_conversion.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,7 @@ def process_stylesheet_assets
127127
when 'thumbnails.less', 'labels.less', 'badges.less', 'buttons.less'
128128
file = extract_nested_rule file, 'a&'
129129
when 'glyphicons.less'
130-
file = replace_rules(file, /\s*@font-face/) { |rule|
131-
rule = replace_all rule, /(\$icon-font(?:-\w+)+)/, '#{\1}'
132-
replace_asset_url rule, :font
133-
}
130+
file = replace_rules(file, /\s*@font-face/) { |rule| replace_asset_url rule, :font }
134131
when 'type.less'
135132
file = apply_mixin_parent_selector(file, '\.(text|bg)-(success|primary|info|warning|danger)')
136133
# .bg-primary will not get patched automatically as it includes an additional rule. fudge for now
@@ -512,7 +509,8 @@ def replace_image_urls(less)
512509
def replace_escaping(less)
513510
less = less.gsub(/~"([^"]+)"/, '\1').gsub(/~'([^']+)'/, '\1') # Get rid of ~"" escape
514511
less.gsub!(/\$\{([^}]+)\}/, '$\1') # Get rid of @{} escape
515-
less.gsub!(/"([^"\n]*)(\$[\w\-]+)([^"\n]*)"/, '"\1#{\2}\3"') # interpolate variable in string, e.g. url("$file-1x") => url("#{$file-1x}")
512+
# interpolate variables in strings, e.g. url("$file-1x") => url("#{$file-1x}")
513+
less.gsub!(/"[^"\n]*"/) { |str| str.gsub(/\$[^"\n$.\\]+/, '#{\0}') }
516514
less.gsub(/(\W)e\(%\("?([^"]*)"?\)\)/, '\1\2') # Get rid of e(%("")) escape
517515
end
518516

0 commit comments

Comments
 (0)