如何在angular CLI项目中包含来自node_modules的资产 [英] How to include assets from node_modules in angular cli project
本文介绍了如何在angular CLI项目中包含来自node_modules的资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将外部库中的资产包含到Angular CLI项目中
How to include assets from external library into Angular CLI project
我正在下面尝试,但这不起作用,
I am trying below but this does not work,
"assets": [
"../node_modules/<external library>/assets/"
]
脚本运行正常,
"scripts": [
"../node_modules/<external library>/some.js",
"startup.js"
]
Angular版本:2.4.1
Angular Version : 2.4.1
Angular CLI:1.0.0-beta.24
Angular CLI : 1.0.0-beta.24
有什么建议吗?
推荐答案
现在确实存在!
要使用它,请像这样更新您的.angular-cli.json文件...
To use it, update your .angular-cli.json file like so...
角度版本2-5:
"assets": [
"assets",
{ "glob": "**/*", "input": "../node_modules/<external library>/assets/", "output": "./assets/" }
]
角度版本> = 6:
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "./node_modules/<your-node-module>/<possibly-subfolders>/",
"output": "./assets/"
},
这篇关于如何在angular CLI项目中包含来自node_modules的资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文