问题描述
我在使用Material模块作为UI界面的angular 5应用程序上工作,我为我的所有项目创建了模板,我希望项目将这个应用程序用作库,并且我对模板[sidebar,navigationbar]的常规部分所做的更改将在库并应用于所有项目.这是一个好模式吗?如果可能的话,如何在角度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 可以将TypeScript库编译并打包为Angular Package Format的节点库.它通常用于将组件从CLI项目中拉出并将其打包为可以在其他Angular应用程序中使用的格式.
执行npm install ng-packagr --save-dev
If you want to create a reusable libraryyou 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组件库.
Refer this Building an Angular 4 Component Library with the Angular CLI and ng-packagr.
这篇关于从整个角度的应用程序创建角度库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!