角度不同的构建 [英] Angular Different Builds

查看:57
本文介绍了角度不同的构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用最新版本的Angular并遇到以下问题:

I'm using latest version of Angular and have the following issue:

我有一个应用程序,想要创建两个版本:完整版本和演示.那样的话,我的意思是我想创建两个不同的版本,这些版本将共享大多数代码,但具有不同的UI.为简单起见,如果我有一个工具栏,我想根据版本更改它的视图.

I have an app and want to create two versions: a full version and a demo. By that, I mean I want to create two different builds that will shared the majority of code, but will have a different UI. for simplicity, if I have a toolbar, I want to change it's view based on the version.

我想做的是创建一个称为工具栏的抽象组件,并制作两个扩展它的具体类:FullToolbar和DemoToolbar.在我的主要html文件中,我将调用相同的组件,但是它将在编译时以某种方式选择它的实现. 有人可以指导我以某种方式实现我想要的结果吗?

What I thought doing is to create an abstract component which is called Toolbar and to make 2 different concrete classes that extend it: FullToolbar and DemoToolbar. In my main html file I will call the same component , but it's implementation will be chosen somehow in compile time. Can anyone guide me to achieve the result I want in some way?

我还要补充一点,我想使用一个干净的解决方案并编译出不必要的类和功能.例如,如果我有完整版本的用户管理服务/组件,则希望将其保留在演示版本中.

I will also add that I want to use a clean solution and compile-out unnecessary classes and functionality. For example, If I have a user management service/component in my full version, I want noting of it to remain in the demo version.

推荐答案

我建议您使用NX来构建2个不同的应用程序Demo和Prod,可以使用lib在这两个应用程序之间共享代码

i suggest that you use NX to build 2 differents apps, Demo and Prod, you can use libs to share code between the 2 apps

这将帮助您为您的2个应用制作一个monorepo并优化您的构建.

this will help you to have a monorepo for your 2 apps and optimize your builds.

了解更多详情 nrwl NX

这篇关于角度不同的构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆