Angular 4本地CSS文件给出404错误

时间:2017-08-31 18:19:27

标签: html css

我的Angular 4 App中的index.html的head元素中有以下内容:

<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <title>Plant Simulator</title>
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css">
  <link href="//fonts.googleapis.com/css?family=Titillium+Web:700|Source+Serif+Pro:400,700|Merriweather+Sans:400,700|Source+Sans+Pro:400,300,600,700,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css">
  <!-- link rel="stylesheet" href="styles.css" type="text/css" -->
  <link rel="stylesheet" href="//demo.productionready.io/main.css">

</head>

<body>
  <app-root>Loading...</app-root>
</body>

</html>

如果我使用styles.css文件的本地路径,我可以从浏览器控制台看到它总是抛出404错误,说找不到styles.css,如下面的屏幕截图所示:

enter image description here

关于这是为什么的任何想法?如果我从CDN加载css,它工作正常,但我想让它在本地呈现!

0 个答案:

没有答案