从整个角度的应用程序创建角度库 [英] create angular library from whole angular's app

查看:28
本文介绍了从整个角度的应用程序创建角度库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用材料模块作为 UI 界面的 angular 5 应用程序,我为我的所有项目创建模板,我希望项目使用这个应用程序作为库,我对模板 [侧边栏,导航栏] 的一般部分的更改更新库并适用于所有项目.这是一个好模式吗?如果可能,如何在角度 5 中执行此操作?

I work on angular 5 application that use material module as a UI interface, i create template for all my projects and i want projects use this application as a library and my changes to general part of template [sidebar, navigationbar] update on library and apply to all projects. is this a good pattern? if this possible, how to do this in angular 5?

推荐答案

如果你想创建一个可重用的库你可以使用 ng-packagr ng-packagr 是一个可以将 TypeScript 库编译并打包为 Angular 包格式的节点库.它通常用于从 CLI 项目中提取组件并将它们打包成可以在其他 Angular 应用程序中使用的格式.
执行 npm install ng-packagr --save-dev

If you want to create a reusable library you can use ng-packagr ng-packagr is a node library that can compile and package a TypeScript library to Angular Package Format. it is commonly used for pulling components out of CLI project and package them up into a format that can be used within other Angular applications.
execute npm install ng-packagr --save-dev

参考这个 使用 Angular CLI 和 ng-packagr 构建 Angular 4 组件库.

这篇关于从整个角度的应用程序创建角度库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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