2016-08-24 31 views
2

我一直在嘗試對此進行排序一段時間;我的目標是在Aurelia框架內使用聚合物模塊。有一個教程here(在官方文檔中),但這不適用於CLI生成的應用程序。Aurelia-Polymer使用CLI工具

aurelia.json文件具有以下依存關係:

… 
"aurelia-html-import-template-loader", 
"aurelia-polymer", 
… 

(安裝使用NPM)

的index.html文件看起來像這樣:

<head> 
<title>Aurelia</title> 

<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script> 
<link rel="import" href="bower_components/polymer/polymer.html"> 

...

我在構建CLI /控制檯時沒有錯誤。

main.js

aurelia.use.plugin('aurelia-polymer'); 

加載罰款,但

aurelia.use.plugin('aurelia-html-import-template-loader'); 

給出錯誤的瀏覽器控制檯:

vendor-bundle.js:21513 GET http://localhost:9000/app.html 
Unhandled rejection Error: Load timeout for modules: template-registry- ……… 

我一直跟一幫小夥子在aurelia/gitter上,但到目前爲止,我發現沒有人能夠得到'aure在CLI中執行lia-html-import-template-loader'working。

感謝您的閱讀, 有一個真棒一天

回答

0

aurelia-polymer

使用帶的WebPack

如果您使用的WebPack,你將無法使用 奧裏利亞-html-import-template-loader,這意味着您將無法直接在您的模板中加載聚合物元素(請參閱#18) 。建議您使用 建議您使用vulcanize將您使用的所有Polymer 元素捆綁到一個可在index.html中加載的文件中。 元素在加載後仍然可以在您的模板中使用,但是 可以避免需要HTML導入模板 加載程序的語法問題。

我還沒有嘗試過aurelia-cli,但它值得一試。