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

@ui-entropy/scanner-core

v0.3.0

Published

CSS waste detection engine - finds unused classes and IDs in your codebase

Readme

@ui-entropy/scanner-core

Core CSS waste detection engine for programmatic use. Powers the UI Entropy CLI and dashboard.

npm version Tests TypeScript

This package provides the core analysis engine for UI Entropy Scanner. It's designed for programmatic use in Node.js applications, build tools, and custom integrations.

For command-line usage, see @ui-entropy/cli which includes smart initialization and colored output.

🚀 Features

  • Smart CSS Parsing - Supports Bootstrap, Tailwind, custom CSS with PostCSS
  • Multi-Framework Support - Works with React, Vue, Angular, HTML, and more
  • Accurate Detection - Handles variants (hover:, dark:), pseudo-classes, complex selectors
  • Fast Scanning - Optimized file crawling with glob patterns
  • Configurable - .gitignore integration, custom ignore patterns
  • TypeScript Native - Full type definitions included

📦 Installation

npm install @ui-entropy/scanner-core

For CLI usage, install the main package instead:

npm install -g @ui-entropy/cli

The CLI includes smart project initialization:

npx @ui-entropy/cli init  # Auto-detects your framework
npx @ui-entropy/cli scan  # Scan with generated config

🔧 Quick Start

import { scan } from '@ui-entropy/scanner-core';

// Scan your entire project
const result = scan({
  baseDir: '/path/to/your/project',
  cssPattern: '**/*.css',
  sourcePattern: '**/*.{html,jsx,tsx,vue}',
  format: 'text'
});

console.log(result.output);

📊 Example Output

🔍 UI Entropy Analysis Report
═══════════════════════════════════════════════

📊 Summary
Total CSS Size:           45.2 KB
Total Rules:              1,247
Files Scanned:            89

🎯 Selectors
Total Selectors:          1,247
Used Selectors:           329 (26%)
Unused Selectors:         918

💰 CSS Waste Analysis
Waste Percentage:         73.6%
Estimated Wasted Bytes:   33.3 KB

💡 CRITICAL WASTE: Significant cleanup needed.

🛠️ API Reference

scan(options)

Main scanning function.

Options:

  • baseDir - Project root directory (required)
  • cssPattern - Glob pattern for CSS files (default: **/*.css)
  • sourcePattern - Glob pattern for source files
  • format - Output format: 'text' | 'json' | 'summary'
  • ignorePatterns - Additional patterns to ignore

Returns: ScanResult with analysis data and formatted output

extractSelectors(cssContent)

Extract all CSS selectors from a stylesheet.

extractUsageFromMultiple(files, baseDir)

Find all class/ID usage across source files.

analyzeWaste(selectors, usage)

Calculate waste metrics and identify unused selectors.

Related Packages

  • ui-entropy - CLI tool for terminal usage
  • UI Entropy Dashboard (coming soon) - Team analytics and historical tracking

📚 Documentation

📝 License

Proprietary - See LICENSE file.
Use subject to UI Entropy subscription terms.

💬 Support


Built with TypeScript, PostCSS, and modern tooling for professional development teams.