Search code examples
htmlcssangularassets

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


Solution

  • 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