I am writing an angular2 application using angular-cli. I follow the structure like - global styles are imported/put in styles.scss which is specified in angular-cli.json -> styles: [] - each component will have its own scss Everything is working fine
However, I have been told that when build and run the application, those styles will be converted to inline styles and inserted to header of main html file (index.html). I have inspected index.html while running the app and saw many inline-style sections are inserted in. Also people told me the solution is putting all in one css file and put a link in index.html, that big css file will be downloaded and cached, which will give user a faster loading performance for the next uses However I rarely see any angular2 application designing with this solution, I think it must have a reason behind that I dont know Anyone please give me an explanation
I guess it's all about compiliation type. There is AOT (Ahead Of Time) and JIT (Just In Time). I would suggest you to read about it at angular 2 cookbook they have really nicely described it.
Creators of angular suggest you to use JIT in development and AOT in production.