Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2/4 : How to load css file from Assets

In my .angular-cli.json, I define this :

"styles": [
  "node_modules/bootstrap/dist/css/bootstrap.min.css",
  "src/assets/css/main.css",
  "styles.css"
],

And in my assets folder I have (assets/css/*.css) .. But when i run my app, CSS doesn't loaded .. How can I resolve it please ? You can check jpeg file in attachment

enter image description here

like image 574
user1814879 Avatar asked May 23 '17 13:05

user1814879


1 Answers

I got same error once I have started Angular 4 project

What I have done is

In my assets there is no css

"assets": [
        "assets",
        "favicon.png"
      ],

And in style

"styles": [
        "../src/assets/css/main.css",
]

And then please do ng serve again

Hope this helps

like image 53
Jalay Oza Avatar answered Sep 30 '22 03:09

Jalay Oza