css - 警告 : @import must precede all other statements (besides @charset)

标签 css angular bootstrap-4

我正在开发 angular 应用程序,在运行应用程序时它没有显示任何错误,但我在许多 css 文件中收到这种警告。

Module Warning (from ./node_modules/postcss-loader/src/index.js):
Warning

 (114:1) @import must precede all other statements (besides @charset)

我在 114 线上导入的是这个。
@import url(http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);

我曾经在所有显示此类警告的 css 中像这样导入。

有什么解决办法吗?

最佳答案

我想通过两个屏幕截图来解释它为什么会发出警告。
因为你没有使用 @import ....在第一行。
请参阅此屏幕截图,它发出警告。
enter image description here
见下面的截图这是解决方案:
警告已经消失,因为我在 style.css 文件的第一行使用了 @import ... 行。
enter image description here

关于css - 警告 : @import must precede all other statements (besides @charset),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58004095/

相关文章:

CSS:使 iframe 充满和高度,没有滚动条

javascript - 在关闭按钮旁边的模式标题中 float 按钮

Angular routerLink 不带矩阵参数的相对导航

angular - 服务请求出现 404 错误。如何更改回复状态

javascript - 比较两个密码的 JS 脚本不起作用

javascript - jQuery - 使 <pre> 具有其内容的宽度

jquery - jquery 对话框的 css 属性

javascript - 从 Angular 6 中的对象中删除值

javascript - 将 Bootstrap 4 导入 angular 2 CLI

css - bootstrap 4 css 显示卡片右下角包含文本的黄色三 Angular 形,是 css 的方式吗?