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

tree-sitter-css-strict

v0.1.3

Published

Strict CSS grammar for tree-sitter

Readme

tree-sitter-css-strict

Verify crates.io

A tree-sitter grammar for strict CSS, for standalone stylesheets. It is a maintained fork of tree-sitter/tree-sitter-css that tracks upstream CSS syntax but treats // as invalid outside strings and URLs, as browsers do. The upstream grammar accepts JavaScript-style line comments for injected CSS, which can hide broken stylesheets in a standalone file. This grammar also accepts valid unquoted relative URLs such as url(../fonts/a.eot); protocol-relative URLs such as url(//cdn.example.com/a.png), double slashes in strings, and /* block comments */ remain valid.

Installation

Rust:

cargo add tree-sitter tree-sitter-css-strict

Node:

npm install tree-sitter-css-strict

A GitHub Packages copy is also published as @alfpricot/tree-sitter-css-strict.

Requirements

  • Rust 1.85 or later (rust-version in Cargo.toml) for the crate.
  • A C compiler, because both bindings compile the generated parser (src/parser.c) and src/scanner.c; the Node binding falls back to compiling when no prebuilt binary matches the platform.
  • Node 24 for development (.nvmrc); the tree-sitter peer dependency is ^0.25.0 and is optional.

Usage

Rust:

let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_css_strict::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading strict CSS parser");
let tree = parser.parse("a { color: red; }", None).unwrap();
assert!(!tree.root_node().has_error());

Node:

import Parser from 'tree-sitter';
import CSS from 'tree-sitter-css-strict';

const parser = new Parser();
parser.setLanguage(CSS);

The Rust crate exports HIGHLIGHTS_QUERY; the Node binding exposes it as CSS.HIGHLIGHTS_QUERY. See ARCHITECTURE.md for how the grammar, bindings, and queries fit together.

How to contribute

Branch from dev, run tree-sitter generate after every grammar.js change, and commit the regenerated parser files with it. Run tree-sitter test, cargo test, npm run lint, and npm run format:check before opening a pull request. CONTRIBUTING.md has the exact commands.

License

MIT. See LICENSE and NOTICE.