Angular CLI with Hybrid app ng-build

十年热恋 提交于 2019-12-11 04:39:51

问题


I'm currently upgrading an AngularJS app to an Angular app, using Angular CLI.

My problem is that when I build the app using ng build, it would copy all the files to the dist folder but will ignore all the AngularJS files. For all the js files, my solution was to add them to the scripts array in the angular-cli.json. Now, I just need to handle the html files. For the Angular app, angular cli will handle them automatically for me, but the AngularJS ones will stay outside the dist folder. A solution I came up with, was to add them to the assets array. So basically I have two questions:

  1. Is there a way where I can tell angular cli to build all .html files from a certain folder? something like that: "assets": [ "app/ng1/.*html" ]

  2. Is this best practice? or is there a better way to achieve what I want?

Thanks!


回答1:


I found a solution for my first question: In the assets array, instead of putting the plain path of the html files, I used glob: { "glob": "**/*.html", "input": "./app/ng1", "output": "./app/ng1" } while using ** will pick all the sub-directories in /app/ng1



来源:https://stackoverflow.com/questions/44990274/angular-cli-with-hybrid-app-ng-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!