# postcss-parcel-css

> PostCSS plugin to use @parcel/css

Latest version **0.5.1** (published 2022-09-13) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install postcss-parcel-css
pnpm add postcss-parcel-css
yarn add postcss-parcel-css
bun add postcss-parcel-css
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.5.1 |
| Published | 2022-09-13 |
| First published | 2022-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^12.20.0 \|\| ^14.13.0 \|\| >=15.0.0 |
| Dependencies | 3 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 48 |
| Author | Stéphane Goetz |
| Maintainers | stephane.goetz |
| Keywords | css, minifier, minify, compress, optimisation, parcel, postcss, plugin |

## Links

- npm: https://www.npmjs.com/package/postcss-parcel-css
- Repository: https://github.com/onigoetz/postcss-parcel-css
- Homepage: https://github.com/onigoetz/postcss-parcel-css#readme
- Issues: https://github.com/onigoetz/postcss-parcel-css/issues
- npm.io page: https://npm.io/package/postcss-parcel-css

## Dependencies (3)

- [@parcel/css](https://npm.io/package/@parcel/css.md) ^1.0.1
- [browserslist](https://npm.io/package/browserslist.md) ^4.19.1
- [@ampproject/remapping](https://npm.io/package/@ampproject/remapping.md) ^2.1.1

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.5.1 (latest) — 2022-09-13
- 0.5.0 — 2022-03-08
- 0.4.0 — 2022-02-14
- 0.3.0 — 2022-01-21
- 0.2.0 — 2022-01-14
- 0.1.1 — 2022-01-13
- 0.1.0 — 2022-01-13

## README

# postcss-parcel-css

> This package is deprecated, please use [`postcss-lightningcss`](https://www.npmjs.com/package/postcss-lightningcss) instead.

This PostCSS plugin uses [@parcel/css](https://www.npmjs.com/package/@parcel/css) to compile and minify your CSS.

`@parcel/css` is more than a minifier as it can replace quite a few PostCSS plugins such as `autoprefixer`.
You can find the complete list of features in the [package's documentation](https://github.com/parcel-bundler/parcel-css#from-node) and the list of plugins it's able to replace below.

## Install

```
yarn add -D postcss-parcel-css
```

## Usage

```javascript
const postcss = require("postcss");
const postcssParcelCss = require("postcss-parcel-css");

postcss([postcssParcelCss(/* pluginOptions */)]).process(
  YOUR_CSS /*, processOptions */
);
```

## Options

```javascript
const postcssParcelCss = require("postcss-parcel-css");

postcssParcelCss({
  // Use a browserslist query that will inform which browsers are supported
  // Will add or remove vendor prefixes that are needed or not anymore
  browsers: ">= .25%",
  // Will pass all options to @parcel/css
  // Check out their documentation for details:
  // https://www.npmjs.com/package/@parcel/css#user-content-documentation
  parcelCssOptions: {
    // Enable minification (default: true)
    minify: true,

    // Enable source maps (default: true)
    sourceMap: true,

    // Compile as cssModules (default: undefined)
    cssModules: false,

    // For which browsers to compile (default: undefined)
    // Can be omitted if you set the `browsers` option
    targets: {
      safari: (13 << 16) | (2 << 8), // represents Safari 13.2.0
    },

    // Individually enable various drafts
    drafts: {
      // Enable css nesting (default: undefined)
      nesting: false,
    },
  },
});
```

The detailed list of `parcelCssOptions` can be found [here](https://github.com/parcel-bundler/parcel-css/blob/master/node/index.d.ts)

## About source maps

Source maps will pass through `@parcel/css`.
But many mappings will be lost in translation; **`@parcel/css` creates only a source map for selectors**.
Mappings for properties cannot be re-created after this transformation.

## PostCSS plugins that you can remove if you have `@parcel/css`

The rows marked as "Depends on browser config" will convert your CSS only if:

1. You set the `browsers` or `parcelCssOptions.targets` options
2. one of the target browsers doesn't support the feature

| PostCSS Plugin                          | @parcel/css option                    |
| --------------------------------------- | ------------------------------------- |
| `autoprefixer`                          | Depends on browser config             |
| `postcss-clamp`                         | Depends on browser config             |
| `postcss-color-hex-alpha`               | Depends on browser config             |
| `postcss-color-hsl`                     | Depends on browser config             |
| `postcss-color-rgb`                     | Depends on browser config             |
| `postcss-color-function`                | Depends on browser config             |
| `postcss-color-rebeccapurple`           | Depends on browser config             |
| `postcss-custom-media`                  | `parcelCssOptions.drafts.customMedia` |
| `postcss-double-position-gradients`     | Depends on browser config             |
| `postcss-hwb-function`                  | Depends on browser config             |
| `postcss-lab-function`                  | Depends on browser config             |
| `postcss-logical`                       | Depends on browser config (1)         |
| `postcss-media-minmax`                  | Depends on browser config             |
| `postcss-multi-value-display`           | Depends on browser config             |
| `postcss-nesting`                       | `parcelCssOptions.drafts.nesting`     |
| `postcss-normalize-display-values`      | Depends on browser config             |
| `postcss-oklab-function`                | Depends on browser config             |
| `postcss-overflow-shorthand`            | Depends on browser config             |
| `postcss-place`                         | Depends on browser config             |
| `postcss-progressive-custom-properties` | Depends on browser config (2)         |

1. `@parcel/css` doesn't support the [`logical` shorthand keyword](https://drafts.csswg.org/css-logical/#logical-shorthand-keyword) as its syntax is likely to change
2. Progressive custom properties works only if the properties don't contain properties themselves:
  - `lab(29.2345% 39.3825 20.0664)` has a proper fallback
  - `oklch(40% 0.234 0.39 / var(--opacity-50))` will not have a fallback

## License

MIT

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