npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@csstools/postcss-todo-or-die

v2.0.8

Published

Write TODOs in CSS that ensure you actually do them.

Downloads

165

Readme

PostCSS Todo or Die

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 and todo-or-die in ruby

The intention is to get a clear signal when a TODO can be resolved. 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. Once they become false they will throw an exception.

.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:

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

Use it as a PostCSS plugin:

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

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

PostCSS Todo or Die runs in all Node environments, with special instructions for:

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.

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

@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 :

@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> = [ '<' | '>' | '=' ]