# @greenwood/plugin-postcss

> A Greenwood plugin for loading PostCSS configuration and applying it to your CSS.

Latest version **0.34.0** (published 2026-07-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @greenwood/plugin-postcss
pnpm add @greenwood/plugin-postcss
yarn add @greenwood/plugin-postcss
bun add @greenwood/plugin-postcss
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.34.0 |
| Published | 2026-07-11 |
| First published | 2021-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 131 |
| Author | Owen Buckley |
| Maintainers | thescientist13 |
| Keywords | Greenwood, Static Site Generator, Server Side Rendering, Full Stack Web Development, Serverless, Web Components, PostCSS |

## Links

- npm: https://www.npmjs.com/package/@greenwood/plugin-postcss
- Repository: https://github.com/ProjectEvergreen/greenwood
- Homepage: https://github.com/ProjectEvergreen/greenwood/tree/master/packages/plugin-postcss
- Issues: https://github.com/ProjectEvergreen/greenwood/issues
- npm.io page: https://npm.io/package/@greenwood/plugin-postcss

## Dependencies (3)

- [postcss](https://npm.io/package/postcss.md) ^8.4.49
- [postcss-import](https://npm.io/package/postcss-import.md) ^16.1.0
- [postcss-preset-env](https://npm.io/package/postcss-preset-env.md) ^7.0.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.34.0 (latest) — 2026-07-11
- 0.35.0-alpha.4 (alpha) — 2026-11-07
- 0.35.0-alpha.3 — 2026-10-10
- 0.35.0-alpha.2 — 2026-09-26
- 0.35.0-alpha.1 — 2026-08-29
- 0.35.0-alpha.0 — 2026-08-08
- 0.34.0-alpha.9 — 2026-06-28
- 0.34.0-alpha.8 — 2026-06-28
- 0.34.0-alpha.7 — 2026-06-27
- 0.34.0-alpha.6 — 2026-05-31
- 0.34.0-alpha.5 — 2026-04-18
- 0.34.0-alpha.4 — 2026-01-31
- 0.34.0-alpha.3 — 2026-01-31
- 0.34.0-alpha.2 — 2025-12-20
- 0.34.0-alpha.1 — 2025-11-08
- … 157 more at https://npm.io/package/@greenwood/plugin-postcss/versions

## README

# @greenwood/plugin-postcss

## Overview

A Greenwood plugin for loading [**PostCSS**](https://postcss.org/) configuration and applying it to your CSS.  For more information and complete docs on Greenwood, please visit [our website](https://www.greenwoodjs.dev).

> This package assumes you already have `@greenwood/cli` installed.

## Installation

You can use your favorite JavaScript package manager to install this package.

```bash
# npm
$ npm i -D @greenwood/plugin-postcss

# yarn
$ yarn add @greenwood/plugin-postcss --dev

# pnpm
$ pnpm add -D @greenwood/plugin-postcss
```

## Usage

Add this plugin to your _greenwood.config.js_:

```javascript
import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss';

export default {
  // ...

  plugins: [
    greenwoodPluginPostCss()
  ]
}
```

By default, this plugin provides a default _postcss.config.js_ that includes support for [**postcss-preset-env**](https://github.com/csstools/postcss-preset-env) using [**browserslist**](https://github.com/browserslist/browserslist) and [**postcss-import**](https://www.npmjs.com/package/postcss-import).

```javascript
export default {
  plugins: [
    (await import('postcss-import')).default,
    (await import('postcss-preset-env')).default
  ]
};
```

> Note: Greenwood provides the behavior of postcss-import out of the box.

## Types

Types should automatically be inferred through this package's exports map, but can be referenced explicitly in both JavaScript (JSDocs) and TypeScript files if needed.

```js
/** @type {import('@greenwood/plugin-postcss').PostCssPlugin} */
```

```ts
import type { PostCssPlugin } from '@greenwood/plugin-postcss';
```

## Options

### Configuration

To use your own PostCSS configuration, you'll want to create your own _postcss.config.js_ (or _.ts_) file at the root of your project, by which you can provide your own [custom plugins and settings](https://github.com/postcss/postcss-cli?tab=readme-ov-file#config).

```js
export default {
  plugins: [
    (await import('postcss-nested')).default
  ]
};
```

### Extend Config

If you would like to _extend_ the default configuration with your own custom _postcss.config.js_, you can enable the `extendConfig` option of this plugin.

```js
import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss';

export default {
  // ...

  plugins: [
    greenwoodPluginPostCss({
      extendConfig: true
    })
  ]
};
```

This will then process your CSS with PostCSS using the configured plugins / settings you provide, merged _after_ the default Greenwood configuration listed above.

---
_Source: https://npm.io/package/@greenwood/plugin-postcss · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
