样式不是从 angular.json 样式数组 angular 6 中选取的,但在 style.css 中的导入工作正常 [英] styles not picking from angular.json styles array angular 6, but working fine with imports in styles.css

查看:17
本文介绍了样式不是从 angular.json 样式数组 angular 6 中选取的,但在 style.css 中的导入工作正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 angular.json 样式数组中包含了一些样式,如下所示:

I included some styles in angular.json styles array like below:

 "styles": [
              "src/styles.css",
              "node_modules/primeicons/primeicons.css",
              "node_modules/primeng/resources/themes/omega/theme.css",
              "node_modules/primeng/resources/themes/bootstrap/theme.css",
              "node_modules/primeng/resources/primeng.min.css",
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
              "node_modules/font-awesome/css/font-awesome.css"
            ]

但它不选择样式,因为我看不到primeng 表样式和其他样式.虽然如果我在我的 style.css 文件中导入样式,它工作正常,如下所示:

but its not picking styles, as i cant see primeng table styling and other styles. although it works fine if i import styles in my styles.css file like below:

@import '../node_modules/primeng/resources/themes/omega/theme.css';
 @import '../node_modules/primeng/resources/themes/bootstrap/theme.css';
 @import '../node_modules/primeicons/primeicons.css'

我相信我们可以使用上述任何方法,如果这不正确,请告诉我.

i believe any of the above methods we can use, let me know if this is not correct.

我也多次重启 ng serve.

i also restarted ng serve multiple times.

感谢任何帮助.感谢期待.

Any help is appreciated. thanks in anticipation.

我正在使用 angular 6,因为它在 angular.json 中很明显,如果需要共享任何其他代码或信息,也请告诉我.

I am using angular 6 as its obvious from angular.json, also let me know if any other code or info has to be shared.

推荐答案

在styles数组中添加css后停止 angular 项目的本地服务器并重新启动它,简单来说重启当前 angular 项目的本地服务器

After adding the css in styles array stop the local server of your angular project and start it again, In simple words restart the local server of the current angular project

这篇关于样式不是从 angular.json 样式数组 angular 6 中选取的,但在 style.css 中的导入工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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