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

时间:2015-01-18 01:58:41

标签: css gruntjs compass-sass angular-ui-bootstrap grunt-contrib-compass

我已将bootstrap-sass添加到我的项目中并将其导入到我的application.scss文件中

@

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

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

在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

构建的

感谢。

1 个答案:

答案 0 :(得分:0)

您应该能够更改指南针配置并将fonts_dir设置为'fonts'而不是(看起来像)'。tmp / styles / fonts'。