Angular - including CSS file in index.html

后端 未结 5 948
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-12 12:27

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:

5条回答
  •  误落风尘
    2021-02-12 13:24

    Basically there are three different ways to do that :-

    1. By adding it to the "styles" array in angular-cli.json file as is shown by @penleychan in his answer.
    "styles": [
            "../node_modules/bootstrap/dist/css/bootstrap.min.css",
            "styles.css"
          ]
    
    1. You can directly import the css file into styles.css file (or any other css file) that is included in "styles" array in angular-cli.json file by adding the @import statement at the top of that file.
    @import "~bootstrap/dist/css/bootstrap.min.css";
    
    1. Include the css file in index.html page by adding a link element.

    You can find a more elaborated explanation and a few more alternatives at this link

提交回复
热议问题