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

@functionalcss/vite

v0.1.3

Published

FCSS Vite plugin — source scanning, production purge, and dev diagnostics

Readme

@functionalcss/vite

Vite plugin for FCSS — adds production CSS purging and development dynamic-fragment warnings for React+Vite projects.

Features

  • Production purge — removes unused FCSS utility classes at build time (via PostCSS AST, not regex).
  • Dev diagnostics — warns when dynamic template literals in className prevent static analysis.
  • HMR support — triggers full reload when fcss.config.ts changes.
  • No runtime JS — zero FCSS code is added to the browser bundle.

Installation

npm install @functionalcss/core @functionalcss/vite -D

Setup

vite.config.ts

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { fcss } from '@functionalcss/vite';

export default defineConfig({
  plugins: [react(), fcss()],
});

fcss.config.ts

import type { FcssViteConfig } from '@functionalcss/vite';

const config: FcssViteConfig = {
  content: ['src/**/*.{ts,tsx}', '!node_modules/**'],
};

export default config;

src/main.tsx

import '@functionalcss/core/full.css';

Options

| Option | Type | Description | | ----------------- | -------------------------------------- | ------------------------------------------------------------------------------------ | | config.content | string[] | Glob patterns pointing to source files. Defaults to src/**/*.{html,js,jsx,ts,tsx}. | | config.safelist | Array<string \| { pattern: RegExp }> | Classes to always keep, regardless of whether they appear in source. |

Static class pattern

FCSS relies on static analysis. Use string literals or class maps — not template literals:

// ✅ Correct: static class map
const stateClass: Record<string, string> = {
  active:   'opacity--1',
  inactive: 'opacity--0.5',
};
<div className={stateClass[isActive ? 'active' : 'inactive']} />

// ✅ Correct: static string
<div className="display--flex padding--16" />

// ❌ Wrong: template literal prevents static analysis
<div className={`display--flex opacity--${isActive ? '1' : '0.5'}`} />

The plugin warns about dynamic fragments in dev mode and purges those classes in production.

Dynamic class map pattern

For conditional classes, use an explicit map object:

const buttonVariant: Record<'primary' | 'ghost', string> = {
  primary: 'background-color--black color--white',
  ghost: 'background-color--white color--black',
};

<button className={buttonVariant[variant]}>{label}</button>;

Production purge report

When vite build runs, the plugin logs a purge summary:

[@functionalcss/postcss] Purge: 17/326313 selectors retained (326296 removed, 100.0% reduction, ...)

Peer dependencies

  • vite ^5.0.0 || ^6.0.0
  • @functionalcss/core (for the CSS and manifest)