简体   繁体   English

将AngularJs javascript文件包含到Angular CLI中

[英]Include AngularJs javascript files into Angular cli

I have a legacy Angular JS application and now working in tandem with few new Angular 5 components using upgrade module. 我有一个旧的Angular JS应用程序,现在与少数几个使用升级模块的新Angular 5组件协同工作。 Following this post here 下面这篇文章在这里

Currently, I need to include all my AngularJs code into my index.html . 当前,我需要将所有AngularJs代码都包含在index.html But, I want to include all JS files (more than 200) in my angular-cli.json in scripts section like below: 但是,我想在以下脚本部分的angular-cli.json中包含所有JS文件(超过200个):

 "scripts": [
    "../appjs/**"
  ],

But, ng-build gives me error no such file or directory:\\appjs\\** . 但是, ng-build no such file or directory:\\appjs\\**给我错误no such file or directory:\\appjs\\**

How to include all the files in the folder in on go avoiding to include all the files one by one. 如何在进行时将所有文件包含在文件夹中,避免一一包含所有文件。

Here is the image of the folder structure. 这是文件夹结构的图像。 在此处输入图片说明

Please guide. 请指导。 Thanks. 谢谢。

Unfortunately the scripts: [] attribute doesn't accept globbing patterns. 不幸的是,脚本:[]属性不接受globbing模式。 This is alluded to in the documentation : 这在文档中有所提及:

scripts: An object containing JavaScript script files to add to the global context of the project. 脚本:包含要添加到项目的全局上下文中的JavaScript脚本文件的对象。 The scripts are loaded exactly as if you had added them in a tag inside index.html. 脚本的加载方式与您将其添加到index.html内的标记中完全相同。

So the alternative is to use a powershell script or DOS cmd to list the files and output them to the screen/file and then add all the necessary quotes to paste them into the scripts attribute in the config file. 因此,替代方法是使用Powershell脚本或DOS cmd列出文件并将其输出到屏幕/文件,然后添加所有必需的引号以将它们粘贴到配置文件中的scripts属性中。

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

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