Tree shaking bootstrap css 特定 angular bootstrap 模块

Tree shaking bootstrap css for specific angular bootstrap modules

是否可以仅为我在我的应用程序中使用的 angular-bootstrap 模块指定 css 规则?例如,我只使用 angular bootstrap 的下拉菜单、日期选择器和工具提示模块。但是,这三个模块需要整个 bootstrap css 文件。我没有在我的应用程序的其余部分使用 bootstraps css,所以我认为导入整个 css 文件是多余的。

Webpack has a built in treeshaking function,如果您的项目已经完成或正在开发中,这将是最简单的选择。

我还发现了 manually compiles Bootstrap and uses Gulp to do the treeshaking in the mean time 的 treeshaking。我发现它更难并且可能输出相同的结果,但让自己舒服。