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 🙏

© 2026 – Pkg Stats / Ryan Hefner

postcss-config-nick2bad4u

v1.0.0

Published

Context-aware PostCSS presets for modern CSS, Tailwind, assets, and production optimization.

Readme

postcss-config-nick2bad4u

CI

Context-aware PostCSS presets for modern CSS, Tailwind CSS, assets, and production optimization. Every path is resolved from the consuming project; the package never assumes that its own installation directory is the project root.

Install

npm install --save-dev postcss postcss-config-nick2bad4u

Install Tailwind CSS when using the Tailwind or full profile:

npm install --save-dev tailwindcss

Basic configuration

Use the base preset as a postcss.config.mjs function so postcss-load-config can supply its current environment and working directory:

import createPostcssConfig from "postcss-config-nick2bad4u";

export default (context) => createPostcssConfig({}, context);

The root export and postcss-config-nick2bad4u/base both provide the base profile. It includes imports, logical properties, flexbug fixes, and Autoprefixer in a stable semantic order.

Profiles

Each subpath supplies a focused default factory:

  • postcss-config-nick2bad4u/base — portable modern-CSS defaults.
  • postcss-config-nick2bad4u/tailwind — base plus the Tailwind PostCSS plugin.
  • postcss-config-nick2bad4u/assets — base plus asset URL and inline-SVG handling.
  • postcss-config-nick2bad4u/production — base plus safe cssnano defaults.
  • postcss-config-nick2bad4u/full — Tailwind, assets, normalization, and environment-aware reporting or minification.

For example:

import createFullConfig from "postcss-config-nick2bad4u/full";

export default (context) =>
 createFullConfig(
  {
   projectRoot: import.meta.dirname,
   assetLoadPaths: ["public", "src/assets"],
   browsers: ["defaults and fully supports es6-module"],
  },
  context
 );

The full profile uses cssnano only when context.env or options.env is production. In other environments it appends postcss-reporter instead.

Production safety

The production preset intentionally uses cssnano's default preset. Selector combining, media-query sorting, and the advanced cssnano preset can alter CSS semantics, so each requires an explicit option:

import createProductionConfig from "postcss-config-nick2bad4u/production";

export default createProductionConfig({
 advancedMinification: true,
 combineDuplicateSelectors: true,
 sortMediaQueries: true,
});

Review the generated CSS before enabling these optimizations in an existing application.

Extending the pipeline

Use named insertion points instead of rebuilding the preset's ordering:

import createPostcssConfig from "postcss-config-nick2bad4u";
import customProperties from "postcss-custom-properties";

export default createPostcssConfig({
 additionalPlugins: {
  beforeOptimization: [customProperties()],
 },
 profile: "production",
});

Plugins in before run before imports. beforeOptimization runs after normal transforms and assets but before optional optimizers. after runs last, including after cssnano, and should be reserved for plugins that explicitly need that position.

Validation

npm run release:verify

This builds the ESM package, runs both TypeScript generations, exercises the configuration through PostCSS, checks coverage and formatting, and validates the packed public surface with publint and Are the Types Wrong.

License

MIT