Skip to content

Commit

Permalink
Fix "$a-$b" -> "#{$a}-#{$b}" conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Dec 14, 2018
1 parent 8c0b5db commit 2e15e66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
12 changes: 6 additions & 6 deletions assets/stylesheets/bootstrap/_glyphicons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
// Import the fonts
@font-face {
font-family: "Glyphicons Halflings";
src: url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{#{$icon-font-name}}.eot"), "#{$icon-font-path}#{#{$icon-font-name}}.eot"));
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"),
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"),
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"),
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"),
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");
src: url(if($bootstrap-sass-asset-helper, twbs-font-path("#{$icon-font-path}#{$icon-font-name}.eot"), "#{$icon-font-path}#{$icon-font-name}.eot"));
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"),
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"),
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"),
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"),
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");
}
}

Expand Down
8 changes: 3 additions & 5 deletions tasks/converter/less_conversion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,7 @@ def process_stylesheet_assets
when 'thumbnails.less', 'labels.less', 'badges.less', 'buttons.less'
file = extract_nested_rule file, 'a&'
when 'glyphicons.less'
file = replace_rules(file, /\s*@font-face/) { |rule|
rule = replace_all rule, /(\$icon-font(?:-\w+)+)/, '#{\1}'
replace_asset_url rule, :font
}
file = replace_rules(file, /\s*@font-face/) { |rule| replace_asset_url rule, :font }
when 'type.less'
file = apply_mixin_parent_selector(file, '\.(text|bg)-(success|primary|info|warning|danger)')
# .bg-primary will not get patched automatically as it includes an additional rule. fudge for now
Expand Down Expand Up @@ -512,7 +509,8 @@ def replace_image_urls(less)
def replace_escaping(less)
less = less.gsub(/~"([^"]+)"/, '\1').gsub(/~'([^']+)'/, '\1') # Get rid of ~"" escape
less.gsub!(/\$\{([^}]+)\}/, '$\1') # Get rid of @{} escape
less.gsub!(/"([^"\n]*)(\$[\w\-]+)([^"\n]*)"/, '"\1#{\2}\3"') # interpolate variable in string, e.g. url("$file-1x") => url("#{$file-1x}")
# interpolate variables in strings, e.g. url("$file-1x") => url("#{$file-1x}")
less.gsub!(/"[^"\n]*"/) { |str| str.gsub(/\$[^"\n$.\\]+/, '#{\0}') }
less.gsub(/(\W)e\(%\("?([^"]*)"?\)\)/, '\1\2') # Get rid of e(%("")) escape
end

Expand Down

0 comments on commit 2e15e66

Please sign in to comment.