user3808059
user3808059

Reputation: 383

style-loader injects css dynamically

Is there a specific reason why webpack's style-loader injects css into html dynamically? I mean, the generated html doesn't contain the <style> tag when I view it in my text editor, but loading the same page in browser I can see that it is actually there. And is there a way to make it a part of html generation process?

Upvotes: 1

Views: 277

Answers (1)

Son Nguyen
Son Nguyen

Reputation: 1482

Webpack bundles all resources together including CSS and injects it on the fly, producing no static CSS in HTML at build-time. For development you have no reason to change this. For production, you can have Webpack extract CSS into separate files by using MiniCssExtractPlugin

Upvotes: 3

Related Questions