首页 文章

使用grunt和node-scss编译bootstrap scss时出错

提问于
浏览
0

我在尝试编译bootstrap scss时遇到以下错误 . 我使用 bower install bootstrap-sass-official 检索了scss文件 .

Warning: bower_components/bootstrap-sass-official/vendor/assets/stylesheets/boot
strap/glyphicons:17: error: non-terminal statement or declaration must end with
';'
 Use --force to continue.

Aborted due to warnings.

我正在使用node-sass 0.8.6和grunt-sass 0.8.1

这是发生错误的sass片段

15 @font-face {
16  font-family: 'Glyphicons Halflings';
17  src: url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'), '#{$icon-font-path}#{$icon-font-name}.eot'));
18  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'),
19   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'),
20   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'),
21   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');
22 }

2 回答

  • 0

    如果有人在NetBeans上:

    我在NetBeans中使用Bootstrap SASS文件时出现了类似的错误,包括_glyphicon.scss文件和mixin文件_image.scss . 您在变量中保存if语句的解决方案在两种情况下都修复了错误 .

    例如 .

    @mixin img-retina($file-1x, $file-2x, $width-1x, $height-1x) {
       $image-if1: if($bootstrap-sass-asset-helper, twbs-image-path("#{$file-1x}"), "#{$file-1x}");
      background-image: url($image-if1);
      ...
    }
    
  • 1

    我从url定义中取出了if语句,并为它们定义了单独的变量,并且它有效 .

相关问题