简体   繁体   中英

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. Following this post here

Currently, I need to include all my AngularJs code into my index.html . But, I want to include all JS files (more than 200) in my angular-cli.json in scripts section like below:

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

But, ng-build gives me error 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. This is alluded to in the documentation :

scripts: An object containing JavaScript script files to add to the global context of the project. The scripts are loaded exactly as if you had added them in a tag inside 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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