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 🙏

© 2025 – Pkg Stats / Ryan Hefner

w3c-validate-css

v1.0.5

Published

Validate CSS offline using the official W3C css-validator.jar

Readme

w3c-validate-css

Tests license npm

Validate CSS offline using the official W3C css-validator.jar

Why? modern build tools can introduce CSS bugs. w3c-validate-css runs locally and prints concise, clickable errors with line numbers using the same rules as the online W3C validator, but entirely offline.

CLI

The easiest way to use this is from the cli using npx, for example:

# Validate a folder, fail only on errors, tolerate a property
npx w3c-validate-css --target dist/css --errors-only --tolerate "pointer-events"

Output:

✗ dist/app.css
    dist/app.css:14:8 - Parse Error: Declaration dropped
    dist/app.css:45 - Unknown pseudo-element or pseudo-class :where()
✓ dist/reset.css

Exits with code 1 if validation fails.

options

Flag | Alias | Value | Default | Description :----------------|:------|:-------------------------|:--------|:-------------------------------------------- --target | -t | <path> | | File or folder to validate (required) --profile | -p | css3\|css21\|css1\|svg | css3 | Validation profile --warnings | -w | 0\|1\|2 | 2 | Warning level: 0 none, 1 normal, 2 all --deprecations | -d | | false | Include deprecation warnings --errors-only | -e | | false | Show only errors; ignore warnings --json | | | false | Output JSON summary --tolerate | | "prop1,prop2" | "" | Downgrade properties to warnings

Node module

npm i w3c-validate-css --save-dev
var validateCss = require('w3c-validate-css');

validateCss('dist/', {
  profile: 'css3',
  warningLevel: 2,
  showDeprecations: false,
  errorsOnly: false,
  json: false
})
.then(function (summary) {
  if (summary.failed > 0) process.exitCode = 1;
})
.catch(function (err) {
  console.error('w3c-validate-css error:', err && err.message ? err.message : String(err));
});

JSON result:

{
  "passed": 1,
  "failed": 1,
  "results": [
    {
      "file": "dist/styles.css",
      "ok": false,
      "errors": [{ "line": 14, "col": 8, "msg": "Parse Error: Declaration dropped" }],
      "warnings": [{ "line": 45, "col": 0, "msg": "Unknown pseudo-element or pseudo-class :where()" }]
    },
    { "file": "dist/reset.css", "ok": true, "errors": [], "warnings": [] }
  ]
}

GitHub Action

name: css-validate
on: [push, pull_request]
jobs:
  css-validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 18
      - run: npx w3c-validate-css --target dist/ --json > css-report.json
      - uses: actions/upload-artifact@v4
        with:
          name: css-report
          path: css-report.json

License

MIT License © Orca Scan - a barcode app with simple barcode tracking APIs.