diff --git a/README.md b/README.md index f9dffc96..4bb4bbfe 100644 --- a/README.md +++ b/README.md @@ -196,9 +196,9 @@ The fonts are referenced as: "#{$icon-font-path}#{$icon-font-name}.eot" ``` -`$icon-font-path` defaults to `bootstrap/`. +`$icon-font-path` defaults to `bootstrap/` if asset path helpers are used, and `../fonts/bootstrap/` otherwise. -When using with Compass, Sprockets, or Mincer, make sure to import the relevant path helpers before Bootstrap itself, for example:. +When using bootstrap-sass with Compass, Sprockets, or Mincer, you **must** import the relevant path helpers before Bootstrap itself, for example: ```scss @import "bootstrap-compass"; diff --git a/assets/stylesheets/bootstrap/_variables.scss b/assets/stylesheets/bootstrap/_variables.scss index e3dcc368..9049d460 100644 --- a/assets/stylesheets/bootstrap/_variables.scss +++ b/assets/stylesheets/bootstrap/_variables.scss @@ -77,7 +77,10 @@ $headings-color: inherit !default; //## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower. //** Load fonts from this directory. -$icon-font-path: "../fonts/bootstrap/" !default; + +// [converter] Asset helpers such as Sprockets and Node.js Mincer do not resolve relative paths +$icon-font-path: if($bootstrap-sass-asset-helper, "bootstrap/", "../fonts/bootstrap/") !default; + //** File name for all font files. $icon-font-name: "glyphicons-halflings-regular" !default; //** Element ID within SVG icon file. diff --git a/tasks/converter/less_conversion.rb b/tasks/converter/less_conversion.rb index b3841d42..5dddfcfa 100644 --- a/tasks/converter/less_conversion.rb +++ b/tasks/converter/less_conversion.rb @@ -94,7 +94,12 @@ class Converter // in Sass 3.3 this can be improved with: function-exists(twbs-font-path) $bootstrap-sass-asset-helper: (twbs-font-path("") != unquote('twbs-font-path("")')) !default; SCSS - file = replace_all file, /(\$icon-font-path:\s+".*)(" !default)/, '\1bootstrap/\2' + file = replace_all file, %r{(\$icon-font-path): \s*"(.*)" (!default);}, <<-SCSS + +// [converter] Asset helpers such as Sprockets and Node.js Mincer do not resolve relative paths +\\1: if($bootstrap-sass-asset-helper, "bootstrap/", "\\2bootstrap/") \\3; +SCSS + '\1: if($bootstrap-sass-asset-helper, "bootstrap/", "\2bootstrap/")\3' when 'close.less' # extract .close { button& {...} } rule file = extract_nested_rule file, 'button&'