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

@elenajs/plugin-rollup-css

v1.0.0

Published

Rollup plugin that minifies individual CSS files and optionally concatenates them into a single bundle.

Readme

Rollup plugin that minifies and bundles individual Elena CSS files

Table of contents

Install

npm install --save-dev @elenajs/plugin-rollup-css

Peer dependency: rollup >= 4.0.0

Usage

Individual CSS files

Emit minified copies of each CSS file from your source directory:

// rollup.config.js
import { cssPlugin } from "@elenajs/plugin-rollup-css";

export default {
  input: "src/index.js",
  output: { dir: "dist", format: "esm" },
  plugins: [cssPlugin("src")],
};

This scans src/ for .css files and emits each one (minified) into the output directory, preserving the original file name.

CSS bundle

Concatenate all CSS files into a single minified bundle:

// rollup.config.js
import { cssBundlePlugin } from "@elenajs/plugin-rollup-css";

export default {
  input: "src/index.js",
  output: { dir: "dist", format: "esm" },
  plugins: [cssBundlePlugin("src", "bundle.css")],
};

CSS Module Scripts

Handle import styles from "./component.css" with { type: "css" } imports. The plugin intercepts these imports, minifies the CSS, and returns a JS module that constructs a CSSStyleSheet for Shadow DOM adoption. CSS files handled this way are automatically excluded from cssBundlePlugin:

// rollup.config.js
import { cssModuleScriptPlugin } from "@elenajs/plugin-rollup-css";

export default {
  input: "src/index.js",
  output: { dir: "dist", format: "esm" },
  plugins: [cssModuleScriptPlugin()],
};

Static styles

Minify CSS strings assigned to static styles template literal class fields:

// rollup.config.js
import { cssStaticStylesPlugin } from "@elenajs/plugin-rollup-css";

export default {
  input: "src/index.js",
  output: { dir: "dist", format: "esm" },
  plugins: [cssStaticStylesPlugin()],
};

All together

Use all plugins together for a complete CSS build pipeline:

// rollup.config.js
import {
  cssPlugin,
  cssBundlePlugin,
  cssModuleScriptPlugin,
  cssStaticStylesPlugin,
} from "@elenajs/plugin-rollup-css";

export default {
  input: "src/index.js",
  output: { dir: "dist", format: "esm" },
  plugins: [
    cssModuleScriptPlugin(),
    cssStaticStylesPlugin(),
    cssPlugin("src"),
    cssBundlePlugin("src", "bundle.css"),
  ],
};

API

cssPlugin(srcDir)

Returns a Rollup plugin that finds all .css files in srcDir and emits each one as a minified asset.

| Parameter | Type | Description | | --------- | -------- | ------------------------------------------ | | srcDir | string | Source directory to scan for .css files. |

cssBundlePlugin(srcDir, fileName)

Returns a Rollup plugin that concatenates all .css files in srcDir, minifies the result, and emits it as a single asset. CSS files resolved by cssModuleScriptPlugin are automatically excluded from the bundle.

| Parameter | Type | Description | | ---------- | -------- | ----------------------------------------------------- | | srcDir | string | Source directory to scan for .css files. | | fileName | string | Output filename for the bundle (e.g. "bundle.css"). |

cssModuleScriptPlugin()

Returns a Rollup plugin that handles CSS Module Script imports (with { type: "css" }). Reads the CSS file, minifies it, and returns a JS module that constructs and exports a CSSStyleSheet for Shadow DOM adoption. Must be listed before @rollup/plugin-node-resolve in the plugins array.

cssStaticStylesPlugin()

Returns a Rollup plugin that finds static styles class fields with template literal values and minifies the CSS inside them.

minifyCss(css, filename?)

Minifies a CSS string using Lightning CSS.

| Parameter | Type | Description | | ----------- | -------- | -------------------------------------- | | css | string | The CSS source to minify. | | filename? | string | Optional filename for error reporting. |

Returns: string, the minified CSS.

License

MIT

Copyright

Copyright © 2026 Ariel Salminen