简体   繁体   中英

As a rule is it better to import css files in styles.css or angular-cli.json?

As a rule is it better to import css files in styles.css using @import or angular-cli.json ? One observation is that css files directly imported as url's for eg. https://fonts.googleapis.com/css?family=Roboto:300,400,500,700 cannot be imported in angular-cli.json but only in styles.css.

Also importing in styles.css does not require a server restart but angular-cli.json requures a server restart. Which of above are recommended and why ?

It really depends on what you are looking for.

you can get that CSS for fonts, add it as static CSS to your styles.css, and download the fonts and serve them yourself.

The other thing to consider is a CDN for those fonts, look up you'll find many CDN providers for google fonts, here is an example http://fontcdn.org/

Additionally, please read the google font faq the have a few recommendations for performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM