2014-02-14 81 views
2

我使用Yeoman,Bower和Grunt(npm install -g yo grunt-cli bower)設置了一個快速應用程序。我安裝了AngularJS生成器(npm install -g generator-angular)並運行yo angular來設置項目目錄。最後在安裝Bootstrap for Angular(bower install angular-bootstrap --save)。Grunt手錶無法編譯.scss,無法找到sass-bootstrap/lib/bootstrap

當我運行grunt server --force時,我發現作爲項目樣式目錄一部分的.scss沒有被編譯爲.css。相反,這個錯誤是:

Syntax error: File to import not found or unreadable: sass-bootstrap/lib/bootstrap. 
      Load path: C:/Users/C8M9S/Desktop/myAngular/app/styles 
    on line 3 of main.scss 

1: $icon-font-path: "/bower_components/sass-bootstrap/fonts/"; 
2: 
3: @import 'sass-bootstrap/lib/bootstrap'; 

任何想法,爲什麼這不是編譯?

回答

1
$icon-font-path: "/bower_components/sass-bootstrap/fonts/"; 

正在尋找整個文件系統根目錄下的bower_components文件夾。在開始處刪除/,並找出相對文件路徑與sass文件所在的bower組件文件夾的相對路徑。這樣的事情:

$icon-font-path: "../../bower_components/sass-bootstrap/fonts/"; 
+0

釷阿克斯,這是我應該撿起來的一個重點。 –

+0

我發現這個問題與最新的角發生器 – FutuToad

4

但錯誤說它在第3行和第3行的代碼甚至不使用$ icon-font-path! 我有一個類似的問題和解決方案是修改Gruntfile.js config來告訴其中的部件按使用「loadPath」參數咕嚕:

grunt.initConfig({ 
    sass: { 
    dist: { 
     options: { 
     style: 'expanded', 
      loadPath: 'bower_components/foundation/scss' 
     }, 
     files: { 
      'public/static/css/main.css': 'app/frontend/scss/foundation.scss' 
     } 
     } 

現在,如果在foundations.scss你有下面這行: @import 「基礎/組件/手風琴」

它看起來手風琴組件:bower_components /基礎/ SCSS /基礎/組件/手風琴

希望這有助於:)

+0

這似乎都有點不穩定這些前緣角發生器.. – FutuToad