简体   繁体   English

如何在ng-boilerplate中包含CDN托管的库?

[英]How to include CDN-hosted libraries with ng-boilerplate?

I want to add the CDN-hosted Firebase Javascript file to my application based on ng-boilerplate. 我想将基于CDN的Firebase Javascript文件添加到基于ng-boilerplate的应用程序中。

I tried just adding it to vendor_files in build.config.js, but it isn't included in the output index.html - maybe because it can't find the file locally? 我尝试仅将其添加到vendor_files中的vendor_files中,但是它不包含在输出index.html中-可能是因为它无法在本地找到文件?

The application works if I add it to the index.html template directly, but that's unclean and breaks the tests. 如果我将其直接添加到index.html模板中,则该应用程序可以正常工作,但这并不干净,并且会破坏测试。

Is there a way to add external files to ng-boilerplate or modify the Gruntfile to add them? 有没有办法将外部文件添加到ng-boilerplate或修改Gruntfile以添加它们?

According to the docs, 根据文档,

the vendor_files.js property holds files to be automatically concatenated and minified with our project source files. vendor_files.js属性保存的文件将与我们的项目源文件自动连接并缩小。

so that won't work. 这样就行不通了 According to Kato's link, it's still under consideration for v0.4. 根据Kato的链接,v0.4仍在考虑中。

Have you looked into angularfire ? 你看过角火了吗?

As for having the files hosted from firebase cdn, add the following right after (or before) the google plus script: 至于从firebase cdn托管文件,请在google plus脚本之后(或之前)添加以下内容:

<script src="//cdn.firebase.com/v0/firebase.js"></script>
<script src="//cdn.firebase.com/libs/angularfire/0.5.0/angularfire.min.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM