# postcss-browser-comments

> Keep only the CSS you need based on comments and your browserslist

Latest version **7.0.0** (published 2026-01-14) · MIT-0 license · 0 weekly downloads

## Install

```sh
npm install postcss-browser-comments
pnpm add postcss-browser-comments
yarn add postcss-browser-comments
bun add postcss-browser-comments
```

## Health

**Score 55/100 (C)** — status: stable.

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

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 7.0.0 |
| Published | 2026-01-14 |
| First published | 2018-06-16 |
| Weekly downloads | 0 |
| License | MIT-0 |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20.19.0 |
| Dependencies | 0 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1052 |
| Maintainers | jonathantneal, alaguna, romainmenke |
| Keywords | browserlists, browsers, browserslists, caniuse, css, lists, postcss, postcss-plugin, support, target |

## Links

- npm: https://www.npmjs.com/package/postcss-browser-comments
- Repository: https://github.com/csstools/postcss-plugins
- Homepage: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-browser-comments#readme
- Issues: https://github.com/csstools/postcss-plugins/issues
- Funding: https://github.com/sponsors/csstools
- npm.io page: https://npm.io/package/postcss-browser-comments

## 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

- 7.0.0 (latest) — 2026-01-14
- 6.0.2 — 2025-11-26
- 6.0.1 — 2024-09-25
- 6.0.0 — 2024-08-03
- 5.0.0 — 2024-05-12
- 4.0.0 — 2021-04-29
- 3.0.0 — 2019-05-24
- 2.0.0 — 2018-09-06
- 1.0.0 — 2018-06-16

## README

# PostCSS Browser Comments [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS]

`npm install postcss-browser-comments --save-dev`

[PostCSS Browser Comments] lets you keep only the CSS you need based on
comments and your [browserslist](https://github.com/browserslist/browserslist).


```css
/**
 * Prevent adjustments of font size after orientation changes in IE and iOS.
 */

html {
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* becomes */


```

The comment and rule above would be removed with the following browserslist:

```yml
last 2 chrome versions
```

The rule below would be more carefully altered:

```css
/**
 * 1. Add the correct box sizing in Firefox.
 * 2. Show the overflow in Edge and IE.
 */

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
  overflow: visible; /* 2 */
}

/* with a `last 2 firefox versions` browserslist becomes */

/**
 * 1. Add the correct box sizing in Firefox.
 * 2. Show the overflow in Edge and IE.
 */

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
}
```

## Usage

Add [PostCSS Browser Comments] to your project:

```bash
npm install postcss postcss-browser-comments --save-dev
```

Use it as a [PostCSS] plugin:

```js
const postcss = require('postcss');
const postcssBrowserComments = require('postcss-browser-comments');

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



## Options

### browsers

The `browsers` option overrides of the project’s browserslist.

```js
postcssBrowserComments({ browsers: 'last 2 versions' })
```

[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test

[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/postcss-browser-comments

[PostCSS]: https://github.com/postcss/postcss
[PostCSS Browser Comments]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-browser-comments

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