I'm receiving an error in my angular 2 project where in the chrome developer tools console there is a message saying GET http://localhost:4200/styles.css with a red x to the left of it. I'm able to use these styles though so what's the deal?
This is my index.html file:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Scorekeeper</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<link rel="stylesheet" href="./styles.css">
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>
Remove that link to your stylesheet from your index.html. You're using the angular-cli and in your configuration, styles.css is being included by the angular-cli. Your link tag in the HTML isn't doing anything.
(The angular cli is also dynamically injecting a link tag for that style into your html, which is why 'it works').
Remove your styleSheet path from index.html and link it through angular-cli.json like this styles:
[
"styles.css",
"css/style.css",
"css-link/bootstrap.css"
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With