Angular cli 发布自定义组件

创建工做空间css

ng new Test --style=scss //Angular6.x及如下能够使用这个命令指定使用.scss样式表ui

ng new Test                     //Angular7 以上版本不能使用上行命令指定scss,使用本行命令,会有css的格式选项进行选择blog

创建组件工程scss

cd testtest

 ng g library Testlib --prefix=enl  //使用—prefix标志是由于咱们但愿库组件是不一样的。若是咱们不这样作,Angular CLI将默认使用lib。angular

构建组件库stl

 ng build --prod Testlib  //从6.1版开始,Angular老是构建咱们的库。若是您仍然使用6.0版本。在构建库时,须要使用—prod标志。样式

 

能够参考https://blog.angularindepth.com/creating-a-library-in-angular-6-87799552e7e5这篇文章co

相关文章
相关标签/搜索