Search code examples
cssangularangular-cli

Angular - including CSS file in index.html


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">

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 animations don't work.

enter image description here

Here is the package I am trying to use, if anyone is curious: https://www.npmjs.com/package/angular2-busy


Solution

  • Angular CLI have it's own way to initialize your global css/js.

    They are located in .angular-cli.json configuration

    Locate "styles": and add your css there

    Example :

    "styles": [
       "../node_modules/angular2-busy/build/style/busy.css",
       "styles.css"
    ],
    

    Hope that helps.