angular-cli how to add global styles?

前端 未结 13 1630
南笙
南笙 2020-12-16 09:18

I created a global style sheet using sass and put it in the public/style/styles.scss. I only specify a background color.

In the index, I added a link to

13条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-16 10:00

    As of the beta.14 release of the CLI (which uses Angular 2.0 final), a global stylesheet can be linked inside angular-cli.json under the "styles" key. This is a reference to a file relative to the src/ directory, which is style.css by default.

    Leveraging this method you could:

    • Copy the global styles into src/styles.css
    • Use CSS imports to import external rules into styles.css
    • Add more global styles via the apps[0].styles property in angular-cli.json

    See also Global Styles in angular-cli's wiki.

提交回复
热议问题