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

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

问题描述

我试图在使用CLI创建的角度项目中使用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:

<link rel="stylesheet" href="/node_modules/angular2-busy/build/style/busy.css">

浏览器告诉我,即使具有正确的路径,也无法找到文件.我还检查了该文件是否存在,并且确实存在.当我拿出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 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天全站免登陆