gpt4 book ai didi

angular - 更改 angular-cli 项目中的目录结构

转载 作者:太空狗 更新时间:2023-10-29 18:08:58 25 4
gpt4 key购买 nike

我一直在研究 angular-cli 以决定我们是否要将它用作我们正在开始的新项目的基础。我们在 Microsoft 工作了很长时间,并且主要了解服务器端知识,因此我们正在尽最大努力了解客户端框架世界的来龙去脉。我们喜欢 angular-cli 项目,因为它具有内置测试、捆绑、摇树等功能,而保留这些功能正是我提出问题的原因。我们遇到了更改默认目录结构的需要。我们使用 MVC 来提供单个 View ,该 View 基本上是 Angular 应用程序的 index.html 文件。如果我们使用标准的 angular-cli 项目文件夹结构执行此操作,则应用程序不会运行或构建,因为所有路径引用都在寻找 .\src\app...

我需要知道的是我需要在 angular-cli 设置中更改什么,以便 cli 的自动监视、构建、绑定(bind)、测试等功能继续使用这个新结构,或者,这是不是我们想要深入研究的东西,因为它在未来会崩溃?

Our folder structure:

最佳答案

angular-cli 中有很多自定义选项可用,您可以通过更新 angular-cli.json 文件来实现同样的效果。

    "root": "src",
"outDir": "dist",
"assets": [
"assets"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "",
"mobile": false,
"styles": [

],
"scripts": [

],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}

大多数配置都是不言自明的,您可以使用这些配置来实现您的需要。

希望这对您有所帮助!

关于angular - 更改 angular-cli 项目中的目录结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40344229/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com