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

@elastikteams/styleguard

v0.1.2

Published

Validate code against style guides - colors, spacing, typography, and component compliance

Readme

StyleGuard

Validate your code against design system style guides.

npm version License: MIT GitHub

Powered by Elastik Teams

What is StyleGuard?

StyleGuard is a CLI tool and Node.js library that automatically validates your HTML/CSS code against your brand's design system or style guide. It helps development teams maintain visual consistency by catching style violations before they reach production.

Why Use StyleGuard?

  • Design System Compliance: Ensure your codebase follows your company's design tokens and brand guidelines
  • Automated Validation: Catch color, spacing, and typography violations in CI/CD pipelines
  • Multiple Input Formats: Import style guides from PDF, Word, Markdown, JSON, or plain text
  • Flexible Output: Generate reports in HTML, Markdown, or JSON formats
  • Zero Config Start: Interactive wizard guides you through validation with file autocomplete

What Does It Check?

| Category | Validations | |----------|-------------| | Colors | Hex, RGB, RGBA, HSL, HSLA values against approved palette | | Spacing | Margin, padding, gap values against spacing scale | | Typography | Font families, sizes, weights, line heights | | Components | Selector-based style rules for buttons, cards, etc. |

Use Cases

  • Validate frontend code during pull request reviews
  • Audit existing projects for design system compliance
  • Convert legacy style guide documents to structured JSON tokens
  • Generate compliance reports for stakeholders

Installation

npm install -g @elastikteams/styleguard

This installs StyleGuard globally. Run it with:

styleguard

Alternative: Local installation

npm install @elastikteams/styleguard --save-dev
npx styleguard --version  # Use npx for local installs

Quick Start

# Interactive mode - guided wizard with file autocomplete
styleguard

# Validate your source code against a style guide
styleguard validate -s ./brand-guide.pdf -p ./src

# Generate an HTML report (auto-opens in browser)
styleguard validate -s ./tokens.json -p ./src -f html

Commands

validate

Validate a target directory against a style guide.

styleguard validate -s <style-guide> -p <target> [options]

Options:

| Option | Description | Default | |--------|-------------|---------| | -s, --styleguide <path> | Path to style guide file | (required) | | -p, --project <path> | Path to project to validate | (required) | | -f, --format <format> | Output format: json, html, md | json | | -o, --output <path> | Write output to file | stdout | | -e, --exclude <folders> | Folders to exclude (comma-separated) | node_modules,dist | | --threshold-errors <n> | Max errors before exit code 1 | 0 | | --threshold-warnings <n> | Max warnings before exit code 1 | Infinity | | --no-open | Do not auto-open HTML reports | - |

Examples:

# Generate HTML report
styleguard validate -s ./brand-guide.pdf -p ./src -f html

# Save report to specific path
styleguard validate -s ./tokens.json -p ./src -f html -o ./report.html

# Fail if more than 5 errors
styleguard validate -s ./tokens.json -p ./src --threshold-errors 5

convert

Convert a style guide document to JSON tokens.

styleguard convert <input> [output]

# Example
styleguard convert ./brand-guide.pdf ./tokens.json

init

Create a configuration file.

styleguard init

Creates styleguard.config.json with default settings.

Supported Formats

| Format | Extensions | |--------|------------| | JSON | .json | | Markdown | .md, .markdown | | PDF | .pdf | | Word | .docx, .doc | | Text | .txt |

Exit Codes

| Code | Meaning | |------|---------| | 0 | Success - all checks passed | | 1 | Validation failed - errors exceed threshold | | 2 | Configuration error | | 3 | File not found | | 4 | Parse error |

License

MIT License - see LICENSE for details.


Powered by Elastik Teams