CSS VarBuddy
May 16, 2026 ยท View on GitHub
Index, find, and use your CSS custom properties in a snap.
Features
CSS VarBuddy provides a dedicated sidebar in VS Code that allows you to:
- ๐ Auto-scan your workspace for CSS custom properties
- ๐ Select folders to scan for CSS and SCSS files
- ๐ Filter properties with real-time search
- โก Quick insert custom properties into your active editor
- ๐ Refresh to re-scan for updated properties
- ๐จ Theme adaptive interface that matches your VS Code theme
Matching CSS Custom Properties
We use the following regular expression to match valid CSS custom property names:
/--[a-zA-Z_][a-zA-Z0-9_-]*/g
This matches strings that: โข Start with -- โข Are followed by a letter (aโz, AโZ) or underscore (_) โข Continue with zero or more letters, digits, underscores, or hyphens
โ Examples โข --main-color โข --_theme โข --Header_1
โ Not matched โข --1st-var (starts with a digit) โข -- (no name) โข -------- (invalid starting character)
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "CSS VarBuddy"
- Click Install
From Source
- Clone this repository
- Run
pnpm install - Run
pnpm run compile - Press F5 to launch the extension in a new VS Code window
Usage
- Open the sidebar: Click the CSS Custom Properties icon in the activity bar (left sidebar)
- Auto-scan: The extension automatically scans your current workspace
- Select folder: Click "Select CSS Folder" to choose a specific directory to scan
- Search: Use the search box to filter properties by name
- Insert: Click on any property to insert
var(--property-name)at your cursor position - Refresh: Click "Refresh" to re-scan for updated properties
Supported File Types
.cssfiles.scssfiles
Development
Prerequisites
- Node.js
- pnpm
- VS Code
Setup
git clone https://github.com/schalkneethling/css-varbuddy.git
cd css-varbuddy
pnpm install
Scripts
pnpm run compile- Compile TypeScriptpnpm run watch- Watch for changes and recompilepnpm run lint- Run ESLintpnpm run package- Create VSIX packagepnpm run publish- Publish to VS Code Marketplacepnpm run publish:patch- Bump the patch version, package, and publish to VS Code Marketplace
Debugging
- Open the project in VS Code
- Press F5 to launch the extension in a new window
- The CSS Custom Properties sidebar will be available in the new window
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Version History
0.3.0
- โจ Added proper VS Code sidebar integration
- ๐จ Improved UI with theme-adaptive design
- ๐ Added refresh functionality
- ๐ Auto-scan workspace folders
- ๐ฏ Better TypeScript compilation setup
- ๐ฆ Added publishing scripts