2017-05-11 101 views
0

我使用Bootstrap scss在Jekyll网站上使用glyphicons时遇到了问题。它似乎不正确地产生路径,但我不知道问题出在哪里。当我尝试包括glyphiconBootstrap scss glyphicons路径错误,缺少路径中的反斜杠

ERROR `/fonts/bootstrapglyphicons-halflings-regular.woff2' not found. 

为glyphicon字体的路径是错误的

哲基尔提供了以下错误,它缺少一个“/”,应该读

/fonts/bootstrap/glyphicons-halflings-regular.woff2 

我试着纠正这在生成的CSS文件,它的工作,所以我现在试图找到不正确的路径生成的地方。

我看了在_glyphicons.scss文件,下面的代码似乎会产生路径

@at-root { 
    // 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'); 
    } 
} 

我也看着_variables.scss,发现这个

$icon-font-path: if($bootstrap-sass-asset-helper, "bootstrap/", "../fonts/bootstrap/") !default; 

我看不到代码中的错误。我对scss不是很熟悉,这是我第一次去。任何人都可以请我指出正确的方向。

回答

0

我之前有过这个问题,我在导入bootstrap之前覆盖了路径。可能不是理想的答案,但可能是一种解决方法。

$icon-font-path: "fonts/bootstrap/" !default; 
@import "_bootstrap"; 
相关问题