Stylesheets

Stylesheets

Embedded Stylesheets

By using style-loader and css-loader it’s possible to embed stylesheets into a Webpack JavaScript bundle. This way you can modularize your stylesheets with your other modules, so stylesheets are as easy as require("./stylesheet.css").

Installation

Install the loaders from npm.

npm install style-loader css-loader --save-dev

Configuration

Here is a configuration example that enables require() CSS:

{
    // ...
    module: {
        loaders: [
            { test: /\.css$/, loader: "style-loader!css-loader" }
        ]
    }
}

For compile-to-css languages see the corresponding loaders for configuration examples. You can pipe them…

登录查看完整内容