Reputation: 525
I'm currently working on a project and Im attempting to load my scss/sass through webpack. I'm currently loading it in successfully using the following libs:
node-sass
sass-loader
css loader
style-loader
I am able to require
/import
the styles in successfully but the problem occurs that when I load up the application the page loads without the styles for about 1.5 seconds and then after the page "blinks" and the styles finally load in.
Is there a way to get around this through webpack? I have heard of ExtractTextPlugin
and a few others but I've tried to implement it by looking at article examples and github examples but they don't seem to work by using require
/import
where they are needed. I'd like to only require the styles based on my react component needs. Not loading any styles that the components don't need.
Upvotes: 7
Views: 2002
Reputation: 1264
You have (at least) two options to prevent this FOUC (Flash of unstyled content):
<head>
(read more) orUpvotes: 2