编译引导指南针文件时如何更改路径



我已经将bootstrap-sass添加到我的项目中,并将其导入到我的application.scss文件中,如下所示

@

import "../bower_components/bootstrap-sass/assets/stylesheets/_bootstrap-compass";
.bootstrap{
  @import "../bower_components/bootstrap-sass/assets/stylesheets/_bootstrap";
}

在引导指南针文件中,有函数

@function twbs-font-path($path) {
  @return font-url($path, true);
}
@function twbs-image-path($path) {
  @return image-url($path, true);
}

这将用于设置图像和字体的路径。

使用指南针构建 css 文件后,css 文件的输出包含以下字体文件的路径

@font-face {
    font-family: 'Glyphicons Halflings';
    src: url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.eot);
    src: url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.eot?#iefix) format("embedded-opentype"), url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.woff) format("woff"), url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.ttf) format("truetype"), url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format("svg");
}

我怎样才能更改它,以便源路径变成:

src: url(./fonts/bootstrap/glyphicons-halflings-regular.eot)

而不是 src:url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.eot)

请注意,application.scss是由grunt-contrib-compass构建的。

谢谢。

您应该

能够更改指南针配置并将fonts_dir设置为"字体"而不是(看起来)".tmp/样式/字体"。

最新更新