1. @webpack-blocks/postcss
Webpack block for PostCSS.
@webpack-blocks/postcss
Package: @webpack-blocks/postcss
Created by: andywer
Last modified: Mon, 13 Jun 2022 01:37:36 GMT
Version: 2.1.0
License: MIT
Downloads: 1,150
Repository: https://github.com/andywer/webpack-blocks

Install

npm install @webpack-blocks/postcss
yarn add @webpack-blocks/postcss

webpack-blocks - PostCSS

Gitter chat
NPM Version

This is the postcss block providing PostCSS configuration.

Usage

 const { createConfig, match } = require('@webpack-blocks/webpack')
const { css } = require('@webpack-blocks/assets')
const postcss = require('@webpack-blocks/postcss')

module.exports = createConfig([
  match(['*.css', '!*node_modules*'], [
    css(),
    postcss()
  ])
])

NOTE: the postcss block handles only the postcss transformation, you must use the css block if
you want to require the css in your browser.

We recommend you to configure PostCSS using the postcss.config.js file (see
PostCSS loader usage):

 // postcss.config.js
const autoprefixer = require('autoprefixer')

module.exports = {
  plugins: [autoprefixer({ browsers: ['last 2 versions'] })]
}

But you can pass configuration directly to the postcss block:

 const { createConfig, match } = require('@webpack-blocks/webpack')
const { css } = require('@webpack-blocks/assets')
const postcss = require('@webpack-blocks/postcss')
const autoprefixer = require('autoprefixer')

module.exports = createConfig([
  css(),
  postcss({
    plugins: [autoprefixer({ browsers: ['last 2 versions'] })]
    /* Other PostCSS options */
  })
])

Options

PostCSS options

parser (optional)

Package name of a custom PostCSS parser to use. Pass for instance 'sugarss' to be able to write
indent-based CSS.

stringifier (optional)

Package name of a custom PostCSS stringifier to use.

syntax (optional)

Package name of a custom PostCSS syntax to use. The package must export a parse and a stringify
function.

plugins (optional)

Array of PostCSS plugins.

webpack-blocks

Check out the

👉 Main documentation

Released under the terms of the MIT license.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code