| [9af201e] | 1 | <div align="center">
|
|---|
| 2 | <img
|
|---|
| 3 | width="180"
|
|---|
| 4 | height="180"
|
|---|
| 5 | hspace="10"
|
|---|
| 6 | alt="PostCSS Logo"
|
|---|
| 7 | src="https://api.postcss.org/logo.svg">
|
|---|
| 8 | <a href="https://github.com/webpack/webpack">
|
|---|
| 9 | <img
|
|---|
| 10 | width="200"
|
|---|
| 11 | height="200"
|
|---|
| 12 | hspace="10"
|
|---|
| 13 | src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">
|
|---|
| 14 | </a>
|
|---|
| 15 | <div align="center">
|
|---|
| 16 | <a href="https://evilmartians.com/?utm_source=postcss">
|
|---|
| 17 | <img
|
|---|
| 18 | src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
|---|
| 19 | alt="Sponsored by Evil Martians"
|
|---|
| 20 | width="236"
|
|---|
| 21 | height="54"
|
|---|
| 22 | vspace="10">
|
|---|
| 23 | </a>
|
|---|
| 24 | </div>
|
|---|
| 25 | </div>
|
|---|
| 26 |
|
|---|
| 27 | [![npm][npm]][npm-url]
|
|---|
| 28 | [![node][node]][node-url]
|
|---|
| 29 | [![deps][deps]][deps-url]
|
|---|
| 30 | [![tests][tests]][tests-url]
|
|---|
| 31 | [![coverage][cover]][cover-url]
|
|---|
| 32 | [![size][size]][size-url]
|
|---|
| 33 |
|
|---|
| 34 | Webpack chat: [![chat][chat]][chat-url]
|
|---|
| 35 |
|
|---|
| 36 | PostCSS chat: [![chat-postcss][chat-postcss]][chat-postcss-url]
|
|---|
| 37 |
|
|---|
| 38 | # postcss-loader
|
|---|
| 39 |
|
|---|
| 40 | Loader to process CSS with [`PostCSS`](https://github.com/postcss/postcss).
|
|---|
| 41 |
|
|---|
| 42 | ## Getting Started
|
|---|
| 43 |
|
|---|
| 44 | You need webpack v5 to use the latest version. For Webpack v4, you have to install postcss-loader v4.
|
|---|
| 45 |
|
|---|
| 46 | To begin, you'll need to install `postcss-loader` and `postcss`:
|
|---|
| 47 |
|
|---|
| 48 | ```console
|
|---|
| 49 | npm install --save-dev postcss-loader postcss
|
|---|
| 50 | ```
|
|---|
| 51 |
|
|---|
| 52 | Then add the plugin to your `webpack` config. For example:
|
|---|
| 53 |
|
|---|
| 54 | > In the following configuration the plugin [`postcss-preset-env`](https://github.com/csstools/postcss-preset-env) is used, which is not installed by default.
|
|---|
| 55 |
|
|---|
| 56 | **file.js**
|
|---|
| 57 |
|
|---|
| 58 | ```js
|
|---|
| 59 | import css from "file.css";
|
|---|
| 60 | ```
|
|---|
| 61 |
|
|---|
| 62 | **webpack.config.js**
|
|---|
| 63 |
|
|---|
| 64 | ```js
|
|---|
| 65 | module.exports = {
|
|---|
| 66 | module: {
|
|---|
| 67 | rules: [
|
|---|
| 68 | {
|
|---|
| 69 | test: /\.css$/i,
|
|---|
| 70 | use: [
|
|---|
| 71 | "style-loader",
|
|---|
| 72 | "css-loader",
|
|---|
| 73 | {
|
|---|
| 74 | loader: "postcss-loader",
|
|---|
| 75 | options: {
|
|---|
| 76 | postcssOptions: {
|
|---|
| 77 | plugins: [
|
|---|
| 78 | [
|
|---|
| 79 | "postcss-preset-env",
|
|---|
| 80 | {
|
|---|
| 81 | // Options
|
|---|
| 82 | },
|
|---|
| 83 | ],
|
|---|
| 84 | ],
|
|---|
| 85 | },
|
|---|
| 86 | },
|
|---|
| 87 | },
|
|---|
| 88 | ],
|
|---|
| 89 | },
|
|---|
| 90 | ],
|
|---|
| 91 | },
|
|---|
| 92 | };
|
|---|
| 93 | ```
|
|---|
| 94 |
|
|---|
| 95 | Alternative use with [config files](#config):
|
|---|
| 96 |
|
|---|
| 97 | **postcss.config.js**
|
|---|
| 98 |
|
|---|
| 99 | ```js
|
|---|
| 100 | module.exports = {
|
|---|
| 101 | plugins: [
|
|---|
| 102 | [
|
|---|
| 103 | "postcss-preset-env",
|
|---|
| 104 | {
|
|---|
| 105 | // Options
|
|---|
| 106 | },
|
|---|
| 107 | ],
|
|---|
| 108 | ],
|
|---|
| 109 | };
|
|---|
| 110 | ```
|
|---|
| 111 |
|
|---|
| 112 | The loader **automatically** searches for configuration files.
|
|---|
| 113 |
|
|---|
| 114 | **webpack.config.js**
|
|---|
| 115 |
|
|---|
| 116 | ```js
|
|---|
| 117 | module.exports = {
|
|---|
| 118 | module: {
|
|---|
| 119 | rules: [
|
|---|
| 120 | {
|
|---|
| 121 | test: /\.css$/i,
|
|---|
| 122 | use: ["style-loader", "css-loader", "postcss-loader"],
|
|---|
| 123 | },
|
|---|
| 124 | ],
|
|---|
| 125 | },
|
|---|
| 126 | };
|
|---|
| 127 | ```
|
|---|
| 128 |
|
|---|
| 129 | And run `webpack` via your preferred method.
|
|---|
| 130 |
|
|---|
| 131 | ## Options
|
|---|
| 132 |
|
|---|
| 133 | | Name | Type | Default | Description |
|
|---|
| 134 | | :---------------------------------: | :------------------: | :-----------------------------------: | :------------------------------------------- |
|
|---|
| 135 | | [`execute`](#execute) | `{Boolean}` | `undefined` | Enable PostCSS Parser support in `CSS-in-JS` |
|
|---|
| 136 | | [`postcssOptions`](#postcssOptions) | `{Object\|Function}` | `defaults values for Postcss.process` | Set `PostCSS` options and plugins |
|
|---|
| 137 | | [`sourceMap`](#sourcemap) | `{Boolean}` | `compiler.devtool` | Enables/Disables generation of source maps |
|
|---|
| 138 | | [`implementation`](#implementation) | `{Function\|String}` | `postcss` | Setup PostCSS implementation to use |
|
|---|
| 139 |
|
|---|
| 140 | ### `execute`
|
|---|
| 141 |
|
|---|
| 142 | Type: `Boolean`
|
|---|
| 143 | Default: `undefined`
|
|---|
| 144 |
|
|---|
| 145 | If you use JS styles the [`postcss-js`](https://github.com/postcss/postcss-js) parser, add the `execute` option.
|
|---|
| 146 |
|
|---|
| 147 | **webpack.config.js**
|
|---|
| 148 |
|
|---|
| 149 | ```js
|
|---|
| 150 | module.exports = {
|
|---|
| 151 | module: {
|
|---|
| 152 | rules: [
|
|---|
| 153 | {
|
|---|
| 154 | test: /\.style.js$/,
|
|---|
| 155 | use: [
|
|---|
| 156 | "style-loader",
|
|---|
| 157 | {
|
|---|
| 158 | loader: "css-loader",
|
|---|
| 159 | },
|
|---|
| 160 | {
|
|---|
| 161 | loader: "postcss-loader",
|
|---|
| 162 | options: {
|
|---|
| 163 | postcssOptions: {
|
|---|
| 164 | parser: "postcss-js",
|
|---|
| 165 | },
|
|---|
| 166 | execute: true,
|
|---|
| 167 | },
|
|---|
| 168 | },
|
|---|
| 169 | ],
|
|---|
| 170 | },
|
|---|
| 171 | ],
|
|---|
| 172 | },
|
|---|
| 173 | };
|
|---|
| 174 | ```
|
|---|
| 175 |
|
|---|
| 176 | ### `postcssOptions`
|
|---|
| 177 |
|
|---|
| 178 | Type: `Object|Function`
|
|---|
| 179 | Default: `undefined`
|
|---|
| 180 |
|
|---|
| 181 | Allows to set [`PostCSS options`](https://postcss.org/api/#processoptions) and plugins.
|
|---|
| 182 |
|
|---|
| 183 | All `PostCSS` options are supported.
|
|---|
| 184 | There is the special `config` option for config files. How it works and how it can be configured is described below.
|
|---|
| 185 |
|
|---|
| 186 | We recommend do not specify `from`, `to` and `map` options, because this can lead to wrong path in source maps.
|
|---|
| 187 | If you need source maps please use the [`sourcemap`](#sourcemap) option.
|
|---|
| 188 |
|
|---|
| 189 | #### `Object`
|
|---|
| 190 |
|
|---|
| 191 | Setup `plugins`:
|
|---|
| 192 |
|
|---|
| 193 | **webpack.config.js** (**recommended**)
|
|---|
| 194 |
|
|---|
| 195 | ```js
|
|---|
| 196 | const myOtherPostcssPlugin = require("postcss-my-plugin");
|
|---|
| 197 |
|
|---|
| 198 | module.exports = {
|
|---|
| 199 | module: {
|
|---|
| 200 | rules: [
|
|---|
| 201 | {
|
|---|
| 202 | test: /\.sss$/i,
|
|---|
| 203 | loader: "postcss-loader",
|
|---|
| 204 | options: {
|
|---|
| 205 | postcssOptions: {
|
|---|
| 206 | plugins: [
|
|---|
| 207 | "postcss-import",
|
|---|
| 208 | ["postcss-short", { prefix: "x" }],
|
|---|
| 209 | require.resolve("my-postcss-plugin"),
|
|---|
| 210 | myOtherPostcssPlugin({ myOption: true }),
|
|---|
| 211 | // Deprecated and will be removed in the next major release
|
|---|
| 212 | { "postcss-nested": { preserveEmpty: true } },
|
|---|
| 213 | ],
|
|---|
| 214 | },
|
|---|
| 215 | },
|
|---|
| 216 | },
|
|---|
| 217 | ],
|
|---|
| 218 | },
|
|---|
| 219 | };
|
|---|
| 220 | ```
|
|---|
| 221 |
|
|---|
| 222 | **webpack.config.js** (**deprecated**, will be removed in the next major release)
|
|---|
| 223 |
|
|---|
| 224 | ```js
|
|---|
| 225 | module.exports = {
|
|---|
| 226 | module: {
|
|---|
| 227 | rules: [
|
|---|
| 228 | {
|
|---|
| 229 | test: /\.sss$/i,
|
|---|
| 230 | loader: "postcss-loader",
|
|---|
| 231 | options: {
|
|---|
| 232 | postcssOptions: {
|
|---|
| 233 | plugins: {
|
|---|
| 234 | "postcss-import": {},
|
|---|
| 235 | "postcss-short": { prefix: "x" },
|
|---|
| 236 | },
|
|---|
| 237 | },
|
|---|
| 238 | },
|
|---|
| 239 | },
|
|---|
| 240 | ],
|
|---|
| 241 | },
|
|---|
| 242 | };
|
|---|
| 243 | ```
|
|---|
| 244 |
|
|---|
| 245 | Setup `syntax`:
|
|---|
| 246 |
|
|---|
| 247 | **webpack.config.js**
|
|---|
| 248 |
|
|---|
| 249 | ```js
|
|---|
| 250 | module.exports = {
|
|---|
| 251 | module: {
|
|---|
| 252 | rules: [
|
|---|
| 253 | {
|
|---|
| 254 | test: /\.sss$/i,
|
|---|
| 255 | loader: "postcss-loader",
|
|---|
| 256 | options: {
|
|---|
| 257 | postcssOptions: {
|
|---|
| 258 | // Can be `String`
|
|---|
| 259 | syntax: "sugarss",
|
|---|
| 260 | // Can be `Object`
|
|---|
| 261 | syntax: require("sugarss"),
|
|---|
| 262 | },
|
|---|
| 263 | },
|
|---|
| 264 | },
|
|---|
| 265 | ],
|
|---|
| 266 | },
|
|---|
| 267 | };
|
|---|
| 268 | ```
|
|---|
| 269 |
|
|---|
| 270 | Setup `parser`:
|
|---|
| 271 |
|
|---|
| 272 | **webpack.config.js**
|
|---|
| 273 |
|
|---|
| 274 | ```js
|
|---|
| 275 | module.exports = {
|
|---|
| 276 | module: {
|
|---|
| 277 | rules: [
|
|---|
| 278 | {
|
|---|
| 279 | test: /\.sss$/i,
|
|---|
| 280 | loader: "postcss-loader",
|
|---|
| 281 | options: {
|
|---|
| 282 | postcssOptions: {
|
|---|
| 283 | // Can be `String`
|
|---|
| 284 | parser: "sugarss",
|
|---|
| 285 | // Can be `Object`
|
|---|
| 286 | parser: require("sugarss"),
|
|---|
| 287 | // Can be `Function`
|
|---|
| 288 | parser: require("sugarss").parse,
|
|---|
| 289 | },
|
|---|
| 290 | },
|
|---|
| 291 | },
|
|---|
| 292 | ],
|
|---|
| 293 | },
|
|---|
| 294 | };
|
|---|
| 295 | ```
|
|---|
| 296 |
|
|---|
| 297 | Setup `stringifier`:
|
|---|
| 298 |
|
|---|
| 299 | **webpack.config.js**
|
|---|
| 300 |
|
|---|
| 301 | ```js
|
|---|
| 302 | const Midas = require("midas");
|
|---|
| 303 | const midas = new Midas();
|
|---|
| 304 |
|
|---|
| 305 | module.exports = {
|
|---|
| 306 | module: {
|
|---|
| 307 | rules: [
|
|---|
| 308 | {
|
|---|
| 309 | test: /\.sss$/i,
|
|---|
| 310 | loader: "postcss-loader",
|
|---|
| 311 | options: {
|
|---|
| 312 | postcssOptions: {
|
|---|
| 313 | // Can be `String`
|
|---|
| 314 | stringifier: "sugarss",
|
|---|
| 315 | // Can be `Object`
|
|---|
| 316 | stringifier: require("sugarss"),
|
|---|
| 317 | // Can be `Function`
|
|---|
| 318 | stringifier: midas.stringifier,
|
|---|
| 319 | },
|
|---|
| 320 | },
|
|---|
| 321 | },
|
|---|
| 322 | ],
|
|---|
| 323 | },
|
|---|
| 324 | };
|
|---|
| 325 | ```
|
|---|
| 326 |
|
|---|
| 327 | #### `Function`
|
|---|
| 328 |
|
|---|
| 329 | **webpack.config.js**
|
|---|
| 330 |
|
|---|
| 331 | ```js
|
|---|
| 332 | module.exports = {
|
|---|
| 333 | module: {
|
|---|
| 334 | rules: [
|
|---|
| 335 | {
|
|---|
| 336 | test: /\.(css|sss)$/i,
|
|---|
| 337 | loader: "postcss-loader",
|
|---|
| 338 | options: {
|
|---|
| 339 | postcssOptions: (loaderContext) => {
|
|---|
| 340 | if (/\.sss$/.test(loaderContext.resourcePath)) {
|
|---|
| 341 | return {
|
|---|
| 342 | parser: "sugarss",
|
|---|
| 343 | plugins: [
|
|---|
| 344 | ["postcss-short", { prefix: "x" }],
|
|---|
| 345 | "postcss-preset-env",
|
|---|
| 346 | ],
|
|---|
| 347 | };
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 | return {
|
|---|
| 351 | plugins: [
|
|---|
| 352 | ["postcss-short", { prefix: "x" }],
|
|---|
| 353 | "postcss-preset-env",
|
|---|
| 354 | ],
|
|---|
| 355 | };
|
|---|
| 356 | },
|
|---|
| 357 | },
|
|---|
| 358 | },
|
|---|
| 359 | ],
|
|---|
| 360 | },
|
|---|
| 361 | };
|
|---|
| 362 | ```
|
|---|
| 363 |
|
|---|
| 364 | #### `config`
|
|---|
| 365 |
|
|---|
| 366 | Type: `Boolean|String`
|
|---|
| 367 | Default: `undefined`
|
|---|
| 368 |
|
|---|
| 369 | Allows to set options using config files.
|
|---|
| 370 | Options specified in the config file are combined with options passed to the loader, the loader options overwrite options from config.
|
|---|
| 371 |
|
|---|
| 372 | ##### Config Files
|
|---|
| 373 |
|
|---|
| 374 | The loader will search up the directory tree for configuration in the following places:
|
|---|
| 375 |
|
|---|
| 376 | - a `postcss` property in `package.json`
|
|---|
| 377 | - a `.postcssrc` file in JSON or YAML format
|
|---|
| 378 | - a `.postcssrc.json`, `.postcssrc.yaml`, `.postcssrc.yml`, `.postcssrc.js`, or `.postcssrc.cjs` file
|
|---|
| 379 | - a `postcss.config.js` or `postcss.config.cjs` CommonJS module exporting an object (**recommended**)
|
|---|
| 380 |
|
|---|
| 381 | ##### Examples of Config Files
|
|---|
| 382 |
|
|---|
| 383 | Using `Object` notation:
|
|---|
| 384 |
|
|---|
| 385 | **postcss.config.js** (**recommend**)
|
|---|
| 386 |
|
|---|
| 387 | ```js
|
|---|
| 388 | module.exports = {
|
|---|
| 389 | // You can specify any options from https://postcss.org/api/#processoptions here
|
|---|
| 390 | // parser: 'sugarss',
|
|---|
| 391 | plugins: [
|
|---|
| 392 | // Plugins for PostCSS
|
|---|
| 393 | ["postcss-short", { prefix: "x" }],
|
|---|
| 394 | "postcss-preset-env",
|
|---|
| 395 | ],
|
|---|
| 396 | };
|
|---|
| 397 | ```
|
|---|
| 398 |
|
|---|
| 399 | Using `Function` notation:
|
|---|
| 400 |
|
|---|
| 401 | **postcss.config.js** (**recommend**)
|
|---|
| 402 |
|
|---|
| 403 | ```js
|
|---|
| 404 | module.exports = (api) => {
|
|---|
| 405 | // `api.file` - path to the file
|
|---|
| 406 | // `api.mode` - `mode` value of webpack, please read https://webpack.js.org/configuration/mode/
|
|---|
| 407 | // `api.webpackLoaderContext` - loader context for complex use cases
|
|---|
| 408 | // `api.env` - alias `api.mode` for compatibility with `postcss-cli`
|
|---|
| 409 | // `api.options` - the `postcssOptions` options
|
|---|
| 410 |
|
|---|
| 411 | if (/\.sss$/.test(api.file)) {
|
|---|
| 412 | return {
|
|---|
| 413 | // You can specify any options from https://postcss.org/api/#processoptions here
|
|---|
| 414 | parser: "sugarss",
|
|---|
| 415 | plugins: [
|
|---|
| 416 | // Plugins for PostCSS
|
|---|
| 417 | ["postcss-short", { prefix: "x" }],
|
|---|
| 418 | "postcss-preset-env",
|
|---|
| 419 | ],
|
|---|
| 420 | };
|
|---|
| 421 | }
|
|---|
| 422 |
|
|---|
| 423 | return {
|
|---|
| 424 | // You can specify any options from https://postcss.org/api/#processoptions here
|
|---|
| 425 | plugins: [
|
|---|
| 426 | // Plugins for PostCSS
|
|---|
| 427 | ["postcss-short", { prefix: "x" }],
|
|---|
| 428 | "postcss-preset-env",
|
|---|
| 429 | ],
|
|---|
| 430 | };
|
|---|
| 431 | };
|
|---|
| 432 | ```
|
|---|
| 433 |
|
|---|
| 434 | **postcss.config.js** (**deprecated**, will be removed in the next major release)
|
|---|
| 435 |
|
|---|
| 436 | ```js
|
|---|
| 437 | module.exports = {
|
|---|
| 438 | // You can specify any options from https://postcss.org/api/#processoptions here
|
|---|
| 439 | // parser: 'sugarss',
|
|---|
| 440 | plugins: {
|
|---|
| 441 | // Plugins for PostCSS
|
|---|
| 442 | "postcss-short": { prefix: "x" },
|
|---|
| 443 | "postcss-preset-env": {},
|
|---|
| 444 | },
|
|---|
| 445 | };
|
|---|
| 446 | ```
|
|---|
| 447 |
|
|---|
| 448 | ##### Config Cascade
|
|---|
| 449 |
|
|---|
| 450 | You can use different `postcss.config.js` files in different directories.
|
|---|
| 451 | Config lookup starts from `path.dirname(file)` and walks the file tree upwards until a config file is found.
|
|---|
| 452 |
|
|---|
| 453 | ```
|
|---|
| 454 | |– components
|
|---|
| 455 | | |– component
|
|---|
| 456 | | | |– index.js
|
|---|
| 457 | | | |– index.png
|
|---|
| 458 | | | |– style.css (1)
|
|---|
| 459 | | | |– postcss.config.js (1)
|
|---|
| 460 | | |– component
|
|---|
| 461 | | | |– index.js
|
|---|
| 462 | | | |– image.png
|
|---|
| 463 | | | |– style.css (2)
|
|---|
| 464 | |
|
|---|
| 465 | |– postcss.config.js (1 && 2 (recommended))
|
|---|
| 466 | |– webpack.config.js
|
|---|
| 467 | |
|
|---|
| 468 | |– package.json
|
|---|
| 469 | ```
|
|---|
| 470 |
|
|---|
| 471 | After setting up your `postcss.config.js`, add `postcss-loader` to your `webpack.config.js`.
|
|---|
| 472 | You can use it standalone or in conjunction with `css-loader` (recommended).
|
|---|
| 473 |
|
|---|
| 474 | Use it **before** `css-loader` and `style-loader`, but **after** other preprocessor loaders like e.g `sass|less|stylus-loader`, if you use any (since [webpack loaders evaluate right to left/bottom to top](https://webpack.js.org/concepts/loaders/#configuration)).
|
|---|
| 475 |
|
|---|
| 476 | **webpack.config.js** (**recommended**)
|
|---|
| 477 |
|
|---|
| 478 | ```js
|
|---|
| 479 | module.exports = {
|
|---|
| 480 | module: {
|
|---|
| 481 | rules: [
|
|---|
| 482 | {
|
|---|
| 483 | test: /\.css$/,
|
|---|
| 484 | use: [
|
|---|
| 485 | "style-loader",
|
|---|
| 486 | {
|
|---|
| 487 | loader: "css-loader",
|
|---|
| 488 | options: {
|
|---|
| 489 | importLoaders: 1,
|
|---|
| 490 | },
|
|---|
| 491 | },
|
|---|
| 492 | "postcss-loader",
|
|---|
| 493 | ],
|
|---|
| 494 | },
|
|---|
| 495 | ],
|
|---|
| 496 | },
|
|---|
| 497 | };
|
|---|
| 498 | ```
|
|---|
| 499 |
|
|---|
| 500 | #### Boolean
|
|---|
| 501 |
|
|---|
| 502 | Enables/Disables autoloading config.
|
|---|
| 503 |
|
|---|
| 504 | **webpack.config.js**
|
|---|
| 505 |
|
|---|
| 506 | ```js
|
|---|
| 507 | module.exports = {
|
|---|
| 508 | module: {
|
|---|
| 509 | rules: [
|
|---|
| 510 | {
|
|---|
| 511 | test: /\.css$/i,
|
|---|
| 512 | loader: "postcss-loader",
|
|---|
| 513 | options: {
|
|---|
| 514 | postcssOptions: {
|
|---|
| 515 | config: false,
|
|---|
| 516 | },
|
|---|
| 517 | },
|
|---|
| 518 | },
|
|---|
| 519 | ],
|
|---|
| 520 | },
|
|---|
| 521 | };
|
|---|
| 522 | ```
|
|---|
| 523 |
|
|---|
| 524 | #### String
|
|---|
| 525 |
|
|---|
| 526 | Allows to specify the path to the config file.
|
|---|
| 527 |
|
|---|
| 528 | **webpack.config.js**
|
|---|
| 529 |
|
|---|
| 530 | ```js
|
|---|
| 531 | const path = require("path");
|
|---|
| 532 |
|
|---|
| 533 | module.exports = {
|
|---|
| 534 | module: {
|
|---|
| 535 | rules: [
|
|---|
| 536 | {
|
|---|
| 537 | test: /\.css$/i,
|
|---|
| 538 | loader: "postcss-loader",
|
|---|
| 539 | options: {
|
|---|
| 540 | postcssOptions: {
|
|---|
| 541 | config: path.resolve(__dirname, "custom.config.js"),
|
|---|
| 542 | },
|
|---|
| 543 | },
|
|---|
| 544 | },
|
|---|
| 545 | ],
|
|---|
| 546 | },
|
|---|
| 547 | };
|
|---|
| 548 | ```
|
|---|
| 549 |
|
|---|
| 550 | ### `sourceMap`
|
|---|
| 551 |
|
|---|
| 552 | Type: `Boolean`
|
|---|
| 553 | Default: depends on the `compiler.devtool` value
|
|---|
| 554 |
|
|---|
| 555 | By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.
|
|---|
| 556 | All values enable source map generation except `eval` and `false` value.
|
|---|
| 557 |
|
|---|
| 558 | **webpack.config.js**
|
|---|
| 559 |
|
|---|
| 560 | ```js
|
|---|
| 561 | module.exports = {
|
|---|
| 562 | module: {
|
|---|
| 563 | rules: [
|
|---|
| 564 | {
|
|---|
| 565 | test: /\.css$/i,
|
|---|
| 566 | use: [
|
|---|
| 567 | { loader: "style-loader" },
|
|---|
| 568 | { loader: "css-loader", options: { sourceMap: true } },
|
|---|
| 569 | { loader: "postcss-loader", options: { sourceMap: true } },
|
|---|
| 570 | { loader: "sass-loader", options: { sourceMap: true } },
|
|---|
| 571 | ],
|
|---|
| 572 | },
|
|---|
| 573 | ],
|
|---|
| 574 | },
|
|---|
| 575 | };
|
|---|
| 576 | ```
|
|---|
| 577 |
|
|---|
| 578 | Alternative setup:
|
|---|
| 579 |
|
|---|
| 580 | **webpack.config.js**
|
|---|
| 581 |
|
|---|
| 582 | ```js
|
|---|
| 583 | module.exports = {
|
|---|
| 584 | devtool: "source-map",
|
|---|
| 585 | module: {
|
|---|
| 586 | rules: [
|
|---|
| 587 | {
|
|---|
| 588 | test: /\.css$/i,
|
|---|
| 589 | use: [
|
|---|
| 590 | { loader: "style-loader" },
|
|---|
| 591 | { loader: "css-loader" },
|
|---|
| 592 | { loader: "postcss-loader" },
|
|---|
| 593 | { loader: "sass-loader" },
|
|---|
| 594 | ],
|
|---|
| 595 | },
|
|---|
| 596 | ],
|
|---|
| 597 | },
|
|---|
| 598 | };
|
|---|
| 599 | ```
|
|---|
| 600 |
|
|---|
| 601 | ### `implementation`
|
|---|
| 602 |
|
|---|
| 603 | Type: `Function | String`
|
|---|
| 604 | Default: `postcss`
|
|---|
| 605 |
|
|---|
| 606 | The special `implementation` option determines which implementation of PostCSS to use. Overrides the locally installed `peerDependency` version of `postcss`.
|
|---|
| 607 |
|
|---|
| 608 | **This option is only really useful for downstream tooling authors to ease the PostCSS 7-to-8 transition.**
|
|---|
| 609 |
|
|---|
| 610 | #### Function
|
|---|
| 611 |
|
|---|
| 612 | **webpack.config.js**
|
|---|
| 613 |
|
|---|
| 614 | ```js
|
|---|
| 615 | module.exports = {
|
|---|
| 616 | module: {
|
|---|
| 617 | rules: [
|
|---|
| 618 | {
|
|---|
| 619 | test: /\.css$/i,
|
|---|
| 620 | use: [
|
|---|
| 621 | { loader: "style-loader" },
|
|---|
| 622 | { loader: "css-loader" },
|
|---|
| 623 | {
|
|---|
| 624 | loader: "postcss-loader",
|
|---|
| 625 | options: { implementation: require("postcss") },
|
|---|
| 626 | },
|
|---|
| 627 | { loader: "sass-loader" },
|
|---|
| 628 | ],
|
|---|
| 629 | },
|
|---|
| 630 | ],
|
|---|
| 631 | },
|
|---|
| 632 | };
|
|---|
| 633 | ```
|
|---|
| 634 |
|
|---|
| 635 | #### String
|
|---|
| 636 |
|
|---|
| 637 | **webpack.config.js**
|
|---|
| 638 |
|
|---|
| 639 | ```js
|
|---|
| 640 | module.exports = {
|
|---|
| 641 | module: {
|
|---|
| 642 | rules: [
|
|---|
| 643 | {
|
|---|
| 644 | test: /\.css$/i,
|
|---|
| 645 | use: [
|
|---|
| 646 | { loader: "style-loader" },
|
|---|
| 647 | { loader: "css-loader" },
|
|---|
| 648 | {
|
|---|
| 649 | loader: "postcss-loader",
|
|---|
| 650 | options: { implementation: require.resolve("postcss") },
|
|---|
| 651 | },
|
|---|
| 652 | { loader: "sass-loader" },
|
|---|
| 653 | ],
|
|---|
| 654 | },
|
|---|
| 655 | ],
|
|---|
| 656 | },
|
|---|
| 657 | };
|
|---|
| 658 | ```
|
|---|
| 659 |
|
|---|
| 660 | ## Examples
|
|---|
| 661 |
|
|---|
| 662 | ### SugarSS
|
|---|
| 663 |
|
|---|
| 664 | You'll need to install `sugarss`:
|
|---|
| 665 |
|
|---|
| 666 | ```console
|
|---|
| 667 | npm install --save-dev sugarss
|
|---|
| 668 | ```
|
|---|
| 669 |
|
|---|
| 670 | Using [`SugarSS`](https://github.com/postcss/sugarss) syntax.
|
|---|
| 671 |
|
|---|
| 672 | **webpack.config.js**
|
|---|
| 673 |
|
|---|
| 674 | ```js
|
|---|
| 675 | module.exports = {
|
|---|
| 676 | module: {
|
|---|
| 677 | rules: [
|
|---|
| 678 | {
|
|---|
| 679 | test: /\.sss$/i,
|
|---|
| 680 | use: [
|
|---|
| 681 | "style-loader",
|
|---|
| 682 | {
|
|---|
| 683 | loader: "css-loader",
|
|---|
| 684 | options: { importLoaders: 1 },
|
|---|
| 685 | },
|
|---|
| 686 | {
|
|---|
| 687 | loader: "postcss-loader",
|
|---|
| 688 | options: {
|
|---|
| 689 | postcssOptions: {
|
|---|
| 690 | parser: "sugarss",
|
|---|
| 691 | },
|
|---|
| 692 | },
|
|---|
| 693 | },
|
|---|
| 694 | ],
|
|---|
| 695 | },
|
|---|
| 696 | ],
|
|---|
| 697 | },
|
|---|
| 698 | };
|
|---|
| 699 | ```
|
|---|
| 700 |
|
|---|
| 701 | ### Autoprefixer
|
|---|
| 702 |
|
|---|
| 703 | You'll need to install `autoprefixer`:
|
|---|
| 704 |
|
|---|
| 705 | ```console
|
|---|
| 706 | npm install --save-dev autoprefixer
|
|---|
| 707 | ```
|
|---|
| 708 |
|
|---|
| 709 | Add vendor prefixes to CSS rules using [`autoprefixer`](https://github.com/postcss/autoprefixer).
|
|---|
| 710 |
|
|---|
| 711 | **webpack.config.js**
|
|---|
| 712 |
|
|---|
| 713 | ```js
|
|---|
| 714 | module.exports = {
|
|---|
| 715 | module: {
|
|---|
| 716 | rules: [
|
|---|
| 717 | {
|
|---|
| 718 | test: /\.css$/i,
|
|---|
| 719 | use: [
|
|---|
| 720 | "style-loader",
|
|---|
| 721 | {
|
|---|
| 722 | loader: "css-loader",
|
|---|
| 723 | options: { importLoaders: 1 },
|
|---|
| 724 | },
|
|---|
| 725 | {
|
|---|
| 726 | loader: "postcss-loader",
|
|---|
| 727 | options: {
|
|---|
| 728 | postcssOptions: {
|
|---|
| 729 | plugins: [
|
|---|
| 730 | [
|
|---|
| 731 | "autoprefixer",
|
|---|
| 732 | {
|
|---|
| 733 | // Options
|
|---|
| 734 | },
|
|---|
| 735 | ],
|
|---|
| 736 | ],
|
|---|
| 737 | },
|
|---|
| 738 | },
|
|---|
| 739 | },
|
|---|
| 740 | ],
|
|---|
| 741 | },
|
|---|
| 742 | ],
|
|---|
| 743 | },
|
|---|
| 744 | };
|
|---|
| 745 | ```
|
|---|
| 746 |
|
|---|
| 747 | > :warning: [`postcss-preset-env`](https://github.com/csstools/postcss-preset-env) includes [`autoprefixer`](https://github.com/postcss/autoprefixer), so adding it separately is not necessary if you already use the preset. More [information](https://github.com/csstools/postcss-preset-env#autoprefixer)
|
|---|
| 748 |
|
|---|
| 749 | ### PostCSS Preset Env
|
|---|
| 750 |
|
|---|
| 751 | You'll need to install `postcss-preset-env`:
|
|---|
| 752 |
|
|---|
| 753 | ```console
|
|---|
| 754 | npm install --save-dev postcss-preset-env
|
|---|
| 755 | ```
|
|---|
| 756 |
|
|---|
| 757 | **webpack.config.js**
|
|---|
| 758 |
|
|---|
| 759 | ```js
|
|---|
| 760 | module.exports = {
|
|---|
| 761 | module: {
|
|---|
| 762 | rules: [
|
|---|
| 763 | {
|
|---|
| 764 | test: /\.css$/i,
|
|---|
| 765 | use: [
|
|---|
| 766 | "style-loader",
|
|---|
| 767 | {
|
|---|
| 768 | loader: "css-loader",
|
|---|
| 769 | options: { importLoaders: 1 },
|
|---|
| 770 | },
|
|---|
| 771 | {
|
|---|
| 772 | loader: "postcss-loader",
|
|---|
| 773 | options: {
|
|---|
| 774 | postcssOptions: {
|
|---|
| 775 | plugins: [
|
|---|
| 776 | [
|
|---|
| 777 | "postcss-preset-env",
|
|---|
| 778 | {
|
|---|
| 779 | // Options
|
|---|
| 780 | },
|
|---|
| 781 | ],
|
|---|
| 782 | ],
|
|---|
| 783 | },
|
|---|
| 784 | },
|
|---|
| 785 | },
|
|---|
| 786 | ],
|
|---|
| 787 | },
|
|---|
| 788 | ],
|
|---|
| 789 | },
|
|---|
| 790 | };
|
|---|
| 791 | ```
|
|---|
| 792 |
|
|---|
| 793 | ### CSS Modules
|
|---|
| 794 |
|
|---|
| 795 | What is `CSS Modules`? Please [read](https://github.com/webpack-contrib/css-loader#modules).
|
|---|
| 796 |
|
|---|
| 797 | No additional options required on the `postcss-loader` side.
|
|---|
| 798 | To make them work properly, either add the `css-loader`’s `importLoaders` option.
|
|---|
| 799 |
|
|---|
| 800 | **webpack.config.js**
|
|---|
| 801 |
|
|---|
| 802 | ```js
|
|---|
| 803 | module.exports = {
|
|---|
| 804 | module: {
|
|---|
| 805 | rules: [
|
|---|
| 806 | {
|
|---|
| 807 | test: /\.css$/i,
|
|---|
| 808 | use: [
|
|---|
| 809 | "style-loader",
|
|---|
| 810 | {
|
|---|
| 811 | loader: "css-loader",
|
|---|
| 812 | options: {
|
|---|
| 813 | modules: true,
|
|---|
| 814 | importLoaders: 1,
|
|---|
| 815 | },
|
|---|
| 816 | },
|
|---|
| 817 | "postcss-loader",
|
|---|
| 818 | ],
|
|---|
| 819 | },
|
|---|
| 820 | ],
|
|---|
| 821 | },
|
|---|
| 822 | };
|
|---|
| 823 | ```
|
|---|
| 824 |
|
|---|
| 825 | ### CSS-in-JS and [`postcss-js`](https://github.com/postcss/postcss-js)
|
|---|
| 826 |
|
|---|
| 827 | You'll need to install `postcss-js`:
|
|---|
| 828 |
|
|---|
| 829 | ```console
|
|---|
| 830 | npm install --save-dev postcss-js
|
|---|
| 831 | ```
|
|---|
| 832 |
|
|---|
| 833 | If you want to process styles written in JavaScript, use the [`postcss-js`](https://github.com/postcss/postcss-js) parser.
|
|---|
| 834 |
|
|---|
| 835 | **webpack.config.js**
|
|---|
| 836 |
|
|---|
| 837 | ```js
|
|---|
| 838 | module.exports = {
|
|---|
| 839 | module: {
|
|---|
| 840 | rules: [
|
|---|
| 841 | {
|
|---|
| 842 | test: /\.style.js$/,
|
|---|
| 843 | use: [
|
|---|
| 844 | "style-loader",
|
|---|
| 845 | {
|
|---|
| 846 | loader: "css-loader",
|
|---|
| 847 | options: {
|
|---|
| 848 | importLoaders: 2,
|
|---|
| 849 | },
|
|---|
| 850 | },
|
|---|
| 851 | {
|
|---|
| 852 | loader: "postcss-loader",
|
|---|
| 853 | options: {
|
|---|
| 854 | postcssOptions: {
|
|---|
| 855 | parser: "postcss-js",
|
|---|
| 856 | },
|
|---|
| 857 | execute: true,
|
|---|
| 858 | },
|
|---|
| 859 | },
|
|---|
| 860 | "babel-loader",
|
|---|
| 861 | ],
|
|---|
| 862 | },
|
|---|
| 863 | ],
|
|---|
| 864 | },
|
|---|
| 865 | };
|
|---|
| 866 | ```
|
|---|
| 867 |
|
|---|
| 868 | As result you will be able to write styles in the following way
|
|---|
| 869 |
|
|---|
| 870 | ```js
|
|---|
| 871 | import colors from "./styles/colors";
|
|---|
| 872 |
|
|---|
| 873 | export default {
|
|---|
| 874 | ".menu": {
|
|---|
| 875 | color: colors.main,
|
|---|
| 876 | height: 25,
|
|---|
| 877 | "&_link": {
|
|---|
| 878 | color: "white",
|
|---|
| 879 | },
|
|---|
| 880 | },
|
|---|
| 881 | };
|
|---|
| 882 | ```
|
|---|
| 883 |
|
|---|
| 884 | > :warning: If you are using Babel you need to do the following in order for the setup to work
|
|---|
| 885 |
|
|---|
| 886 | > 1. Add [`babel-plugin-add-module-exports`](https://github.com/59naga/babel-plugin-add-module-exports) to your configuration.
|
|---|
| 887 | > 2. You need to have only one **default** export per style module.
|
|---|
| 888 |
|
|---|
| 889 | ### Extract CSS
|
|---|
| 890 |
|
|---|
| 891 | Using [`mini-css-extract-plugin`](https://github.com/webpack-contrib/mini-css-extract-plugin).
|
|---|
| 892 |
|
|---|
| 893 | **webpack.config.js**
|
|---|
| 894 |
|
|---|
| 895 | ```js
|
|---|
| 896 | const isProductionMode = process.env.NODE_ENV === "production";
|
|---|
| 897 |
|
|---|
| 898 | const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|---|
| 899 |
|
|---|
| 900 | module.exports = {
|
|---|
| 901 | mode: isProductionMode ? "production" : "development",
|
|---|
| 902 | module: {
|
|---|
| 903 | rules: [
|
|---|
| 904 | {
|
|---|
| 905 | test: /\.css$/,
|
|---|
| 906 | use: [
|
|---|
| 907 | isProductionMode ? MiniCssExtractPlugin.loader : "style-loader",
|
|---|
| 908 | "css-loader",
|
|---|
| 909 | "postcss-loader",
|
|---|
| 910 | ],
|
|---|
| 911 | },
|
|---|
| 912 | ],
|
|---|
| 913 | },
|
|---|
| 914 | plugins: [
|
|---|
| 915 | new MiniCssExtractPlugin({
|
|---|
| 916 | filename: isProductionMode ? "[name].[contenthash].css" : "[name].css",
|
|---|
| 917 | }),
|
|---|
| 918 | ],
|
|---|
| 919 | };
|
|---|
| 920 | ```
|
|---|
| 921 |
|
|---|
| 922 | ### Emit assets
|
|---|
| 923 |
|
|---|
| 924 | To write a asset from PostCSS plugin to the webpack, need to add a message in `result.messages`.
|
|---|
| 925 |
|
|---|
| 926 | The message should contain the following fields:
|
|---|
| 927 |
|
|---|
| 928 | - `type` = `asset` - Message type (require, should be equal `asset`)
|
|---|
| 929 | - `file` - file name (require)
|
|---|
| 930 | - `content` - file content (require)
|
|---|
| 931 | - `sourceMap` - sourceMap
|
|---|
| 932 | - `info` - asset info
|
|---|
| 933 |
|
|---|
| 934 | **webpack.config.js**
|
|---|
| 935 |
|
|---|
| 936 | ```js
|
|---|
| 937 | const customPlugin = () => (css, result) => {
|
|---|
| 938 | result.messages.push({
|
|---|
| 939 | type: "asset",
|
|---|
| 940 | file: "sprite.svg",
|
|---|
| 941 | content: "<svg>...</svg>",
|
|---|
| 942 | });
|
|---|
| 943 | };
|
|---|
| 944 |
|
|---|
| 945 | const postcssPlugin = postcss.plugin("postcss-assets", customPlugin);
|
|---|
| 946 |
|
|---|
| 947 | module.exports = {
|
|---|
| 948 | module: {
|
|---|
| 949 | rules: [
|
|---|
| 950 | {
|
|---|
| 951 | test: /\.css$/i,
|
|---|
| 952 | use: [
|
|---|
| 953 | "style-loader",
|
|---|
| 954 | "css-loader",
|
|---|
| 955 | {
|
|---|
| 956 | loader: "postcss-loader",
|
|---|
| 957 | options: {
|
|---|
| 958 | postcssOptions: {
|
|---|
| 959 | plugins: [postcssPlugin()],
|
|---|
| 960 | },
|
|---|
| 961 | },
|
|---|
| 962 | },
|
|---|
| 963 | ],
|
|---|
| 964 | },
|
|---|
| 965 | ],
|
|---|
| 966 | },
|
|---|
| 967 | };
|
|---|
| 968 | ```
|
|---|
| 969 |
|
|---|
| 970 | ### Add dependencies, contextDependencies, buildDependencies, missingDependencies
|
|---|
| 971 |
|
|---|
| 972 | The dependencies are necessary for webpack to understand when it needs to run recompilation on the changed files.
|
|---|
| 973 |
|
|---|
| 974 | There are two way to add dependencies:
|
|---|
| 975 |
|
|---|
| 976 | 1. (Recommended). The plugin may emit messages in `result.messages`.
|
|---|
| 977 |
|
|---|
| 978 | The message should contain the following fields:
|
|---|
| 979 |
|
|---|
| 980 | - `type` = `dependency` - Message type (require, should be equal `dependency`, `context-dependency`, `build-dependency` or `missing-dependency`)
|
|---|
| 981 | - `file` - absolute file path (require)
|
|---|
| 982 |
|
|---|
| 983 | **webpack.config.js**
|
|---|
| 984 |
|
|---|
| 985 | ```js
|
|---|
| 986 | const path = require("path");
|
|---|
| 987 |
|
|---|
| 988 | const customPlugin = () => (css, result) => {
|
|---|
| 989 | result.messages.push({
|
|---|
| 990 | type: "dependency",
|
|---|
| 991 | file: path.resolve(__dirname, "path", "to", "file"),
|
|---|
| 992 | });
|
|---|
| 993 | };
|
|---|
| 994 |
|
|---|
| 995 | const postcssPlugin = postcss.plugin("postcss-assets", customPlugin);
|
|---|
| 996 |
|
|---|
| 997 | module.exports = {
|
|---|
| 998 | module: {
|
|---|
| 999 | rules: [
|
|---|
| 1000 | {
|
|---|
| 1001 | test: /\.css$/i,
|
|---|
| 1002 | use: [
|
|---|
| 1003 | "style-loader",
|
|---|
| 1004 | "css-loader",
|
|---|
| 1005 | {
|
|---|
| 1006 | loader: "postcss-loader",
|
|---|
| 1007 | options: {
|
|---|
| 1008 | postcssOptions: {
|
|---|
| 1009 | plugins: [postcssPlugin()],
|
|---|
| 1010 | },
|
|---|
| 1011 | },
|
|---|
| 1012 | },
|
|---|
| 1013 | ],
|
|---|
| 1014 | },
|
|---|
| 1015 | ],
|
|---|
| 1016 | },
|
|---|
| 1017 | };
|
|---|
| 1018 | ```
|
|---|
| 1019 |
|
|---|
| 1020 | 2. Pass `loaderContext` in plugin.
|
|---|
| 1021 |
|
|---|
| 1022 | **webpack.config.js**
|
|---|
| 1023 |
|
|---|
| 1024 | ```js
|
|---|
| 1025 | const path = require("path");
|
|---|
| 1026 |
|
|---|
| 1027 | module.exports = {
|
|---|
| 1028 | module: {
|
|---|
| 1029 | rules: [
|
|---|
| 1030 | {
|
|---|
| 1031 | test: /\.css$/i,
|
|---|
| 1032 | use: [
|
|---|
| 1033 | "style-loader",
|
|---|
| 1034 | "css-loader",
|
|---|
| 1035 | {
|
|---|
| 1036 | loader: "postcss-loader",
|
|---|
| 1037 | options: {
|
|---|
| 1038 | postcssOptions: {
|
|---|
| 1039 | config: path.resolve(__dirname, "path/to/postcss.config.js"),
|
|---|
| 1040 | },
|
|---|
| 1041 | },
|
|---|
| 1042 | },
|
|---|
| 1043 | ],
|
|---|
| 1044 | },
|
|---|
| 1045 | ],
|
|---|
| 1046 | },
|
|---|
| 1047 | };
|
|---|
| 1048 | ```
|
|---|
| 1049 |
|
|---|
| 1050 | **postcss.config.js**
|
|---|
| 1051 |
|
|---|
| 1052 | ```js
|
|---|
| 1053 | module.exports = (api) => ({
|
|---|
| 1054 | plugins: [
|
|---|
| 1055 | require("path/to/customPlugin")({
|
|---|
| 1056 | loaderContext: api.webpackLoaderContext,
|
|---|
| 1057 | }),
|
|---|
| 1058 | ],
|
|---|
| 1059 | });
|
|---|
| 1060 | ```
|
|---|
| 1061 |
|
|---|
| 1062 | **customPlugin.js**
|
|---|
| 1063 |
|
|---|
| 1064 | ```js
|
|---|
| 1065 | const path = require("path");
|
|---|
| 1066 |
|
|---|
| 1067 | const customPlugin = (loaderContext) => (css, result) => {
|
|---|
| 1068 | loaderContext.webpack.addDependency(
|
|---|
| 1069 | path.resolve(__dirname, "path", "to", "file")
|
|---|
| 1070 | );
|
|---|
| 1071 | };
|
|---|
| 1072 |
|
|---|
| 1073 | module.exports = postcss.plugin("postcss-assets", customPlugin);
|
|---|
| 1074 | ```
|
|---|
| 1075 |
|
|---|
| 1076 | ## Contributing
|
|---|
| 1077 |
|
|---|
| 1078 | Please take a moment to read our contributing guidelines if you haven't yet done so.
|
|---|
| 1079 |
|
|---|
| 1080 | [CONTRIBUTING](./.github/CONTRIBUTING.md)
|
|---|
| 1081 |
|
|---|
| 1082 | ## License
|
|---|
| 1083 |
|
|---|
| 1084 | [MIT](./LICENSE)
|
|---|
| 1085 |
|
|---|
| 1086 | [npm]: https://img.shields.io/npm/v/postcss-loader.svg
|
|---|
| 1087 | [npm-url]: https://npmjs.com/package/postcss-loader
|
|---|
| 1088 | [node]: https://img.shields.io/node/v/postcss-loader.svg
|
|---|
| 1089 | [node-url]: https://nodejs.org
|
|---|
| 1090 | [deps]: https://david-dm.org/webpack-contrib/postcss-loader.svg
|
|---|
| 1091 | [deps-url]: https://david-dm.org/webpack-contrib/postcss-loader
|
|---|
| 1092 | [tests]: https://github.com/webpack-contrib/postcss-loader/workflows/postcss-loader/badge.svg
|
|---|
| 1093 | [tests-url]: https://github.com/webpack-contrib/postcss-loader/actions
|
|---|
| 1094 | [cover]: https://codecov.io/gh/webpack-contrib/postcss-loader/branch/master/graph/badge.svg
|
|---|
| 1095 | [cover-url]: https://codecov.io/gh/webpack-contrib/postcss-loader
|
|---|
| 1096 | [chat]: https://badges.gitter.im/webpack/webpack.svg
|
|---|
| 1097 | [chat-url]: https://gitter.im/webpack/webpack
|
|---|
| 1098 | [chat-postcss]: https://badges.gitter.im/postcss/postcss.svg
|
|---|
| 1099 | [chat-postcss-url]: https://gitter.im/postcss/postcss
|
|---|
| 1100 | [size]: https://packagephobia.now.sh/badge?p=postcss-loader
|
|---|
| 1101 | [size-url]: https://packagephobia.now.sh/result?p=postcss-loader
|
|---|