$icon-font-path fallback to relative for pure Sass

Refs #650 #662
This commit is contained in:
Gleb Mazovetskiy 2014-07-12 17:22:15 +02:00
Родитель 1a3726a7f9
Коммит bbda75fb7f
3 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -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";

Просмотреть файл

@ -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.

Просмотреть файл

@ -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&'