Bundling CSS

The css-loader property is similar to raw-loader since it imports a CSS file as a string, but it does something more: it parses the file to resolve all references to other files (such as @import statements), thus returning a unique string containing all style information. It may be used as it is if the application needs to process manually, but usually it is chained with other loaders to get the CSS directly in the web page. There are two options:

  • Inserting automatically all styles within a style tag in the web page that includes the JavaScript file importing the CSS. The style-loader does this job. This is the recommended option in development mode, since it supports Hot Module Replacement, so if HMR is on, then changes to ...

Get Hands-On TypeScript for C# and .NET Core Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.