2016-07-29 32 views
8

我試圖在我的Aurelia CLI項目中引入Bootstrap,並且CSS和JS工作正常。Aurelia CLI包括Bootstrap字形

我唯一的問題是圖形需要加載字體文件。

我使用此配置:

"dependencies": [ 
    { 
     "name": "bootstrap", 
     "path": "../node_modules/bootstrap/dist", 
     "main": "js/bootstrap.min", 
     "deps": ["jquery"], 
     "exports": "$", 
     "resources": [ 
      "css/bootstrap.min.css", 
      "fonts/glyphicons-halflings-regular.woff2" 
     ] 
    } 
] 

但我得到含有該線的錯誤:

路徑:「C:\用戶\好色\文件\形式\ node_modules \引導\ DIST \ Fonts \中glyphicons,半身人,regular.js'

所以,即使我包括.woff2文件,奧裏利亞嘗試將文件導入的JS文件。我能做些什麼來完成這項工作? CSS工作正常。

+0

我會玩這個和檢查r快速。這可能是你需要提交一個GitHub問題。 –

回答

2

這已經解決了,更多的信息,請閱讀Github issue

現在可以通過在aurelia.json中添加複製指令來解決此問題。

aurelia.json- 有效的,如果該項目是由奧裏利亞-CLI創建0.25.0或更高

添加在構建塊如下:

"bundles": [ ... ], 
"copyFiles": { 
    "node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2": "bootstrap/fonts", 
    "node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff": "bootstrap/fonts", 
    "node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf": "bootstrap/fonts" 
} 

如果該項目是由較早的CLI版本創建的,則必須在任務文件夾內創建複製任務

之後,調用拷貝任務在build.js/TS任務


* 學分fabioluz的評論這在github