Angular 6 库 - 引导程序样式 [英] Angular 6 Library - bootstrap styles

查看:22
本文介绍了Angular 6 库 - 引导程序样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试创建 Angular 6 库并在其他应用程序中使用它们.它似乎运作良好.我正在关注:https://medium.com/@SirMaxxx/angular-6-creating-a-shareable-control-library-6a27f0ebe5c2

I'm currently experimenting with creating Angular 6 libraries and consuming them in other applications. It seems to be working well. I am following: https://medium.com/@SirMaxxx/angular-6-creating-a-shareable-control-library-6a27f0ebe5c2

我遇到的一个问题是向此类库添加依赖项,尤其是引导程序.

A problem that I am having is adding dependencies to such libraries, in particular with bootstrap.

我想做的是创建一个组件库,它与自定义和 3rd 方样式捆绑在一起,但似乎没有办法做到这一点?

What I am trying to do is to create a component library, which comes bundled with custom and 3rd party styles, however there does not seem to be a way to do that?

我希望将对 bootstrap 的引用添加到类似于以下内容的 angular.json 文件中:

I would expect to add references to bootstrap to angular.json file similar to below:

"styles": [
    "src/styles.css"
],
"scripts": []

..但是 Angular 库不包含 angular.json 文件,这让我相信这样的事情是不可能的/不支持/等等.

..however Angular libraries do not contain angular.json files, which leads me to believe that such a thing is not possible/not supported/etc.

帮助?

推荐答案

不支持开箱即用".由于我必须为我的一位客户提出解决方案,因此我摆弄了一下.最后,我发现两个帖子指向正确的方向.如何包含自定义 SCSS 主题?Dor3nz 的中帖.建议是通过引入额外的自定义构建步骤来构建全局样式文件并将其复制到 dist 文件夹来丰富构建过程.我做了一个小原型,到目前为止,这种方法效果很好,至少在我的情况下是这样.可以在此处找到示例展示方法.希望能帮到你...

This is not supported "Out of the Box". I fiddled a bit around since I had to come up with a solution for one of my customers. In the end I found two posts pointing in the right direction. How to include a custom SCSS theme? and Medium Post of Dor3nz. The suggestion was to enrich the build process by introducing an extra custom build step for building tho Global Style file and copy it over to the dist folder. I did a small prototype and the approach is working quite good so far, at least in my case. Example could be found here Showcasing the approach. Hope it helps...

这篇关于Angular 6 库 - 引导程序样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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