相关疑难解决方法(0)

在自定义 Angular 库中使用 Postcss

我使用postcsspostcss-css-modulesposthtml-css-modules在 Angular 应用程序中实现 CSS 模块。我还使用了@angular-builders/custom-webpack来实现这一点。

现在,我想对我的自定义 Angular 库做同样的事情。但是,我不能使用@angular-builders/custom-webpack,因为 Angular 库是使用ng-packagr构建的。

所以,@angular-builders/custom-webpack不能使用:https : //github.com/just-jeb/angular-builders/issues/356

另一方面,ng-packagr不支持postcsshttps : //github.com/ng-packagr/ng-packagr/issues/1471

我已阅读,它可以延长汇总配置(就是使用编译器NG-packagr在构建结束)在NG-packagr

https://github.com/ng-packagr/ng-packagr/blob/master/docs/DESIGN.md#rollup-config

但我没有找到任何文档来实现这一点。

有人知道怎么做吗?

我认为的其他解决方案,它使所有样式全局化并使用scss-bundle和 postcss编译它们,就像我在这里所做的那样:NodeJs Script that compiles scss files failed because of postcss rule for undefined variables

如果我可以使用lodash,我将能够用散列类名替换类名,就像这里建议的那样:在 JavaScript / TypeScript 文件中使用 [hash:base64:5]

但要做到这一点,我需要知道如何在ng-packagr的构建中调用lodash

有人知道怎么做吗?

任何其他解决方案都非常受欢迎。 …

webpack postcss rollupjs angular ng-packagr

8
推荐指数
1
解决办法
977
查看次数

标签 统计

angular ×1

ng-packagr ×1

postcss ×1

rollupjs ×1

webpack ×1