Angular - 在 index.html 中包含 CSS 文件 [英] Angular - including CSS file in index.html

查看:32
本文介绍了Angular - 在 index.html 中包含 CSS 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在使用 CLI 创建的 angular 项目中使用 angular2-busy 库,但在导入样式表时遇到问题:

I'm trying to use the angular2-busy library in an angular project created with the CLI, but am having an issue importing the stylesheet:

浏览器告诉我它找不到文件,即使路径正确.我还检查了该文件是否存在,并且确实存在.当我取出 rel="stylesheet" 时,我没有收到错误消息,但是动画不起作用.

The browser is telling me that it cannot find the file, even with the correct path. I also checked that the file exists, and it does. When I take out the rel="stylesheet" I don't get the error, but then the animations don't work.

这是我尝试使用的包,如果有人好奇的话:https://www.npmjs.com/package/angular2-busy

Here is the package I am trying to use, if anyone is curious: https://www.npmjs.com/package/angular2-busy

推荐答案

Angular CLI 有自己的方式来初始化你的全局 css/js.

Angular CLI have it's own way to initialize your global css/js.

它们位于 .angular-cli.json 配置中

找到 "styles": 并在那里添加你的 css

Locate "styles": and add your css there

示例:

"styles": [
   "../node_modules/angular2-busy/build/style/busy.css",
   "styles.css"
],

希望有所帮助.

这篇关于Angular - 在 index.html 中包含 CSS 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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