# @csstools/postcss-todo-or-die

> Write TODOs in CSS that ensure you actually do them.

Latest version **4.0.2** (published 2026-10-01) · MIT-0 license · 0 weekly downloads

## Install

```sh
npm install @csstools/postcss-todo-or-die
pnpm add @csstools/postcss-todo-or-die
yarn add @csstools/postcss-todo-or-die
bun add @csstools/postcss-todo-or-die
```

## Health

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

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

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2026-10-01 |
| First published | 2023-02-06 |
| Weekly downloads | 0 |
| License | MIT-0 |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20.19.0 |
| Dependencies | 3 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1061 |
| Maintainers | jonathantneal, alaguna, romainmenke |
| Keywords | code-quality, css, postcss, postcss-plugin, productivity, todo |

## Links

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

## Dependencies (3)

- [browserslist](https://npm.io/package/browserslist.md) ^4.29.0
- [@csstools/css-tokenizer](https://npm.io/package/@csstools/css-tokenizer.md) ^4.0.2
- [@csstools/css-parser-algorithms](https://npm.io/package/@csstools/css-parser-algorithms.md) ^4.0.2

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

- 4.0.2 (latest) — 2026-10-01
- 4.0.1 — 2026-09-25
- 4.0.0 — 2026-01-14
- 3.0.5 — 2025-05-27
- 3.0.4 — 2024-11-01
- 3.0.3 — 2024-10-23
- 3.0.2 — 2024-10-10
- 3.0.1 — 2024-08-18
- 3.0.0 — 2024-08-03
- 2.0.10 — 2024-07-06
- 2.0.9 — 2024-06-29
- 2.0.8 — 2024-05-04
- 2.0.7 — 2024-05-04
- 2.0.6 — 2024-03-13
- 2.0.5 — 2024-02-19
- … 7 more at https://npm.io/package/@csstools/postcss-todo-or-die/versions

## README

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

`npm install @csstools/postcss-todo-or-die --save-dev`

[PostCSS Todo or Die] lets you write TODOs in CSS that ensure you actually do them.

Based on [todo-or-die in rust](https://github.com/davidpdrsn/todo-or-die) and [todo-or-die in ruby](https://github.com/searls/todo_or_die)

The intention is to get a clear signal when a TODO can be resolved.<br>
The clearest signal is a hard error. It forces you to stop and resolve the issue.

`@todo-or-die` rules are considered open TODOs while they are true.<br>
Once they become false they will throw an exception.

```css
.baz {
	/* "hwb" is fully supported */
	@todo-or-die browserslist("chrome < 101, safari < 15, firefox < 96");
	color: pink;
	color: hwb(350 75% 0%);

	/* do something after a date */
	@todo-or-die before-date(3000 01 01);
	content: "2000";
}

/* You can also wrap large chunks of CSS */
@todo-or-die if(20 > 16) {
	.baz {
		color: green;
	}
}

/* becomes */

.baz {
	/* "hwb" is fully supported */
	color: pink;
	color: hwb(350 75% 0%);

	/* do something after a date */
	content: "2000";
}

/* You can also wrap large chunks of CSS */
.baz {
		color: green;
	}
```

## Usage

Add [PostCSS Todo or Die] to your project:

```bash
npm install postcss @csstools/postcss-todo-or-die --save-dev
```

Use it as a [PostCSS] plugin:

```js
const postcss = require('postcss');
const postcssTodoOrDie = require('@csstools/postcss-todo-or-die');

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



## Syntax

[PostCSS Todo or Die] is non-standard and is not part of any official CSS Specification.

### `@todo-or-die` rule

The `@todo-or-die` rule is used to indicate which parts of your CSS have a TODO.
You can either use a lone rule or a block around CSS.

```css
.foo {
	@todo-or-die if(10 > 8);
	color: pink;
}

@todo-or-die if(10 > 8) {
	.foo {
		color: pink;
	}
}
```

You can use these conditions :

| condition | todo | dies |
| --- | --- | --- |
| `if` | when `true` or `unknown` | when `false` |
| `not` | when `false` or `unknown` | when `true` |
| `before-date` | when "now" is before the date | when "now" is after |
| `browserslist` | when browsers match those of your project | when no browsers match |

```css
@todo-or-die if(10 > 8);
@todo-or-die not(10 < 8);
@todo-or-die before-date(2006 01 31); /* year month day */
@todo-or-die browserslist("chrome <= 80");
```

You can combine this plugin with others like `@csstools/postcss-design-tokens` :

```css
@todo-or-die if(10 > design-token('foo.bar'));
```

```
@todo-or-die if(<value> <operator> <value>);
@todo-or-die not(<value> <operator> <value>);
@todo-or-die before-date(<integer> <integer> <integer>);
@todo-or-die browserslist(<string>);

<operator> = [ '<' | '>' | '=' ]
```

[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/@csstools/postcss-todo-or-die

[PostCSS]: https://github.com/postcss/postcss
[PostCSS Todo or Die]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-todo-or-die

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