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

css-variable-lsp

v1.0.16

Published

A CSS Language Server for CSS Variables

Readme

CSS Variable Language Server

A Language Server Protocol (LSP) implementation focused on CSS custom properties (variables). It indexes variables across your workspace and provides completions, hover resolution, and diagnostics.

Features

  • Context-aware completion in CSS property values, inside var(...), and in HTML style="" attributes, with relevance scoring.
  • Workspace-wide indexing across .css, .scss, .sass, .less, plus HTML <style> blocks and inline styles.
  • Cascade-aware hover that orders definitions by !important, specificity, and source order.
  • Go to definition, find references, and rename support.
  • Diagnostics for undefined variables used via var(--name).
  • Color decorations and a color picker with hex/rgb/hsl presentations, including named colors in custom property values and resolved var(--...) usages.

Getting Started

Prerequisites

  • Node.js (ES2020-compatible; v16+ recommended)
  • npm

Install / Build

npm install
npm run compile

Run

# via local build
node out/server.js --stdio

# or, if installed from npm
css-variable-lsp --stdio

Editor Integration

This is a standalone LSP server. Configure it in any LSP client.

VS Code extension

Zed extension

Configuration

Command-line flags:

  • --no-color-preview
  • --color-only-variables (show colors only on var(--...) usages)
  • --lookup-files "<glob>,<glob>" (comma-separated list of glob patterns)
  • --lookup-file "<glob>" (repeatable)
  • --ignore-globs "<glob>,<glob>" (comma-separated list of glob patterns)
  • --ignore-glob "<glob>" (repeatable)
  • --path-display=relative|absolute|abbreviated
  • --path-display-length=N (only used for abbreviated; 0 disables shortening)
  • --undefined-var-fallback=warning|info|off (controls diagnostics for undefined vars when a var() fallback exists)

Environment variables:

  • CSS_LSP_COLOR_ONLY_VARIABLES=1 (same as --color-only-variables)
  • CSS_LSP_LOOKUP_FILES (comma-separated glob patterns; ignored if CLI lookup flags are provided)
  • CSS_LSP_IGNORE_GLOBS (comma-separated glob patterns; ignored if CLI ignore flags are provided)
  • CSS_LSP_DEBUG=1 (enable debug logging)
  • CSS_LSP_PATH_DISPLAY=relative|absolute|abbreviated
  • CSS_LSP_PATH_DISPLAY_LENGTH=1 (same as --path-display-length)
  • CSS_LSP_UNDEFINED_VAR_FALLBACK=warning|info|off

Defaults:

  • --path-display: relative
  • --path-display-length: 1
  • --undefined-var-fallback: warning
  • Lookup globs:
    • **/*.css
    • **/*.scss
    • **/*.sass
    • **/*.less
    • **/*.html
    • **/*.vue
    • **/*.svelte
    • **/*.astro
    • **/*.ripple
  • Ignore globs:
    • **/node_modules/**
    • **/dist/**
    • **/out/**
    • **/.git/**

abbreviated mode shortens each directory segment (except the final one) to the configured length, matching fish-style prompt shortening. Lookup/ignore globs accept standard glob patterns (including brace expansions like **/*.{css,scss}). Ignore globs replace the defaults when provided (include any defaults you still want to keep).

Completion Path Examples

Assume a variable is defined in /Users/you/project/src/styles/theme.css and your workspace root is /Users/you/project.

  • --path-display=relative (default):
    • Defined in src/styles/theme.css
  • --path-display=absolute:
    • Defined in /Users/you/project/src/styles/theme.css
  • --path-display=abbreviated --path-display-length=1:
    • Defined in s/s/theme.css
  • --path-display=abbreviated --path-display-length=2:
    • Defined in sr/st/theme.css
  • --path-display=abbreviated --path-display-length=0 (no shortening):
    • Defined in src/styles/theme.css

Cascade Awareness (Best-Effort)

Hover and color resolution use CSS cascade rules (specificity, !important, source order) but do not model DOM nesting or selector combinators. See LIMITATIONS.md for details.

Project Structure

  • src/ TypeScript source
  • out/ compiled server (npm bin entry)
  • LIMITATIONS.md known limitations

Testing

npm test