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

@cssxio/unplugin

v0.7.0

Published

Universal bundler plugin for CSSX.

Readme

@cssxio/unplugin

CSSX has build tool adapters at these entrypoints:

import cssxEsbuild from '@cssxio/unplugin/esbuild';
import cssxRollup from '@cssxio/unplugin/rollup';
import cssxRspack from '@cssxio/unplugin/rspack';
import cssxVite from '@cssxio/unplugin/vite';
import cssxWebpack from '@cssxio/unplugin/webpack';

Add the selected adapter to your build tool plugins setting:

// vite.config.ts
import cssx from '@cssxio/unplugin/vite';

export default { plugins: [cssx()] };

Vue 3 with Vite

Place CSSX before Vue in the Vite plugin list. CSSX transforms create and sx calls in <script>, <script setup>, and :class="sx(...)" template bindings. Static plain class="..." attributes are intentionally left alone.

import cssx from '@cssxio/unplugin/vite';
import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';

export default defineConfig({ plugins: [cssx(), vue()] });
// rollup.config.js
import cssx from '@cssxio/unplugin/rollup';

export default { plugins: [cssx({ cssFileName: 'assets/cssx.css' })] };
// webpack.config.js
import cssx from '@cssxio/unplugin/webpack';

export default { plugins: [cssx()] };
// rspack.config.js
import cssx from '@cssxio/unplugin/rspack';

export default { plugins: [cssx()] };
// build.mjs
import cssx from '@cssxio/unplugin/esbuild';
import { build } from 'esbuild';

await build({ entryPoints: ['src/main.ts'], bundle: true, plugins: [cssx()] });

Programmatic API

The main entrypoint exports the low-level unpluginFactory, the universal unplugin adapter instance, and named callable factories for Vite, Rollup, webpack, Rspack, and esbuild. Most applications should import one platform entrypoint shown above.

import { transformCssxModule, compileCssxStylesheet } from '@cssxio/unplugin';

const transformed = await transformCssxModule(source, 'src/button.tsx');
const stylesheet = await compileCssxStylesheet([
  {
    id: 'src/button.tsx',
    candidates: transformed?.candidates ?? {},
    origins: transformed?.origins,
    composites: transformed?.composites,
    atomicClasses: transformed?.atomicClasses,
  },
]);

transformCssxModule returns null unless the source module imports the configured CSSX runtime. Otherwise it returns transformed JavaScript, candidate metadata, composite-to-atomic selector metadata, source locations, and a JavaScript source map when the transform creates one. Pass an earlier compatible version 3 source map as its fourth argument to continue that map.

compileCssxStylesheet combines module metadata in stable module and utility order, removes duplicate utilities, aliases each winning atomic rule to the composite classes that use it, and returns generated CSS. It also returns a CSS source map when collected metadata includes source locations. CssxPluginOptions, TransformResult, IncomingSourceMap, CssxSourceModule, and stylesheet source-map types are exported from the main entrypoint.

Options

| Option | Default | What it does | | ------------------ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | importSource | @cssxio/cssx | Module specifier that identifies source files to transform. A source file must contain this text and have a JavaScript or TypeScript extension. | | cssFileName | cssx.css | Relative CSS output path. It must be non-empty, end in .css, and stay within the bundler output directory. [hash] is replaced with a stable hash of the generated CSS. | | stableClassNames | false | Uses source-addressed composite selectors. Enable it for native multi-process builds, such as a Next.js App Router build that transforms server and client modules independently. | | sourceMap | true | Whether to generate a separate CSS source map. Set it to false to omit both the .css.map file and source-map comment. | | layer | — | CSS layer name that wraps generated CSS. It must be a single valid layer identifier, such as cssx. | | theme | — | Inline CSSX @theme source used while transforming and compiling CSS. The theme is compiled into generated rules; it does not add a global stylesheet. | | themeFile | — | Path, relative to the current working directory, to a CSSX @theme file. It is reread when CSS is generated; Rollup-compatible adapters register it as a watched dependency. Do not use it with theme. | | darkMode | media | Activates dark: utilities with the system color-scheme media query (media), [data-theme=dark] (selector), or a .dark ancestor (class). Use the selector that matches your theme controller. | | preflight | true | Adds Tailwind-compatible browser baseline rules before utilities. Set it to false only when the application deliberately owns a different global reset. |

The universal adapter validates options when it is created. theme and themeFile cannot be used together. Invalid CSS paths and layer names fail the build before CSS is emitted.

CSSX emits the Tailwind-compatible browser baseline by default, so utility migrations retain box sizing, inherited typography, link treatment, and native form-control normalization. Set preflight: false only when an existing app stylesheet deliberately owns different global element styles.

Extracted CSS

Each production adapter collects CSS from the source files used by the final build. It does not create a CSS file when no used file has CSSX utilities. The default file is cssx.css. Set cssFileName to use another relative path. CSSX emits one composite class in markup for each static style composition while sharing declarations across composite selectors in the stylesheet.

When stableClassNames: true is used with webpack or Rspack, CSSX scans the project source tree before emitting its public stylesheet. This ensures one stylesheet includes server and client utility selectors even when the framework runs those transformations in separate processes.

The Rollup-compatible adapters retain transformed module metadata until generateBundle, then emit CSS and its map as build assets. The webpack and Rspack adapters retain metadata on native modules and emit assets at the additions stage of processAssets. The direct esbuild adapter enables the metafile, removes data for source files absent from it, and generates CSS in onEnd.

When sourceMap is enabled and source locations are available, generated CSS has a separate .css.map file and a source-map comment. Each mapping points to the source module location of the static utility string that created the rule. transformCssxModule can accept and return JavaScript source maps for build tools that provide a compatible input map.

During local development, the Vite adapter serves the configured cssFileName path from memory, including a source map when one exists. Add a matching stylesheet link to your document. CSSX injects a small page script that refreshes matching stylesheet links after source changes or deletions. Production adapters create the same CSS file, and your app must include it.

With esbuild, outdir places CSS below that directory. outfile places it beside the output file. Without either option, it is placed below the working directory. With write: false, CSS and its map are appended to esbuild's in-memory outputFiles; otherwise they are written to disk. A later esbuild build removes CSS files that CSSX wrote when no utilities remain.

See the workspace README for CSSX syntax, supported utilities, and current exclusions.