-
Notifications
You must be signed in to change notification settings - Fork 268
Extract css out of App container #29
Comments
probably, I'm not sure what the convention is there but that would make sense to me! |
I usually put such css declarations into a generic |
maybe use this https://github.com/webpack/extract-text-webpack-plugin |
Would this also fix the fouc that is visible sometimes when loading the index? |
👍 for @ayhankuru proposition. I used Extract Text Plugin for my project and it works great. What I like about it is that we don't have to change the current file architecture (css files can remain in component folders), and it fixes the fouc. |
@mikaa123 Can you share the code of your solution? I'm really interested :) |
@wieringen sure. There are two parts:
module: {
loaders: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") }
]
},
plugins: [
new ExtractTextPlugin("styles.css")
]
} This tells webpack to create a Reference it from Do we want to do this for the boilerplate? If so, I'd happily make a PR. |
Thanks I will try it out now! :) |
@mikaa123 Wouldn't it be better to only use your solution for the App/style.css and the current solution for all the other css files? |
@wieringen no need to use Extract Text Plugin if we only want to reference App/style.css. As @gpbl said we can create the css file and simply reference it from the index. However, it won't fix the FOUC. The FOUC comes from the CSS being bundled in the JS. Our components get added to the DOM before the CSS exists and boom! Flash of Unstyled Content. Hoisting the CSS fixes it though. I'm sure there are other solutions too. |
I use the |
Should we extract the css for html, body, button from
/client/containers/App/style.css
to another global stylesheet?The text was updated successfully, but these errors were encountered: