Closed vincenzo-antolini-os closed 9 years ago
See how Ben Smithett does it. I hope that helps.
@christianalfoni Any thoughts?
Hi,
I definitely think you should embed styles this way :-)
What Webpack does is removing the "thinking different types of assets". Everything is just a "chunk" you need to load into your project. It being, css, javascript, fonts or an image. So the question is not as much "how to load", but "when to load".
This is where lazy loading and "css by component" comes into play. It depends heavily on the project what strategy works for you, but handling CSS just like you handle JS is a great concept I think.
Very abstract thoughts this, but please tell us a bit about your project and we can come up with some specific suggestions?
:+1: thanks for your opinion... It's too early for suggestions, I have too much informations swirling in my head. My mantra after starting ReactJs and WebPack: "Stay alert! don't overengineering! Be critic!"
I like the concept "you decide when to load an asset" but just now seems to be an abstraction that has no place in real world.
Thanks V
Hi, I read this page: https://christianalfoni.github.io/react-webpack-cookbook/Loading-CSS.html I made some tests, a virtual css style-sheet was appended to
<head>
via javascript. I tested style-loader, css-loader and less-loader chainingstyle!css!less
and it worked as expected.Wow... But I have a lot of questions flying in my head... I really dunno if I want to do this... If not out of scope, can you add some thoughts about embedding css this way?
Thanks V