2015-02-24 106 views
1

我使用https://github.com/Swiip/generator-gulp-angular來模擬我的angularjs應用程序。使用sass的unboud變量

我平坦地發現bootswatch主題並且想要使用它並從[http://bootswatch.com/flatly/][2]兩個文件,_variables.scss和_bootswatch.scss下載。

我這兩個文件添加到我的vendor.scss

$icon-font-path: "../../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/"; 

@import '../../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap'; 

@import "flatly/variables"; 
@import "flatly/bootswatch"; 

gulp serve,我建我的申請,並於控制檯它顯示了我。

project developer$ gulp serve 
[21:28:41] Using gulpfile /Volumes/Developer/angularjs/project/gulpfile.js 
[21:28:41] Starting 'styles'... 
[21:28:42] gulp-inject 2 files into index.scss. 

stream.js:94 
     throw er; // Unhandled stream error in pipe. 
      ^
Error: /Volumes/Developer/angularjs/project/src/app/flatly/_bootswatch.scss:16: error: unbound variable $navbar-default-bg 

    [1]: https://github.com/Swiip/generator-gulp-angular 
    [2]: http://bootswatch.com/flatly/ 

爲什麼unbound variable $navbar-default-bg$navbar-default-bg存在_variables.scss文件。

$ navbar-default-bg:$ brand-primary;

我的項目結構:structure

回答

0

嘗試導入順序變量,引導,bootswatch按照 https://github.com/thomaspark/bootswatch/blob/gh-pages/global/build.scss

@import "flatly/variables"; 
@import '../../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap'; 
@import "flatly/bootswatch"; 

樣板嘗試編譯src文件夾中的所有文件.scss(當它應該忽略以_開頭的scss文件)。

移動flaty/src目錄之外使它的行爲如

@import "../../flatly/variables"; 
@import '../../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap'; 
@import "../../flatly/bootswatch"; 
+0

我試了一下,並沒有奏效。 – 2015-02-25 11:01:19

+0

這似乎是https://github.com/Swiip/generator-gulp-angular樣板的問題。 它編譯_xxx.scss文件時,它不是假設 – CJSewell 2015-02-25 11:46:31

+0

樣板試圖編譯src文件夾中的所有.scss文件(當它應該忽略以_開頭的scss文件)。 – CJSewell 2015-02-25 11:50:35