Skip to content

willofindie/vscode-cssvar

Repository files navigation

CSSVar (A VSCode Extension)

CssVar Icon CssVar Icon

CSS Extension Support

Details here: Customize Extension

Features:

This extension helps to autocomplete globally shared CSS Variables and a lot more.

Supported Configs:

This Extension supports the following properties as of now:

  • cssvar.files: Array of Strings: string[]

    • Should contain relative/absolute path from your workspace root folder.
    • Supports glob patterns.
    • Only keep the files that have CSS Variables; this will boost the performance.
  • cssvar.extensions: Array of String: string[]

Supported Extensions:

"css" | "scss" | "sass" | "less" | "postcss" | "vue" | "svelte" | "ts" | "tsx" | "jsx" | "js"

NOTE: Open issue to add more extension support.

  • cssvar.themes: Array of String: string[]
    • Eg: cssvar.themes: ["dark"]. This will help the extension distinguish between similarly named variables.
  • cssvar.excludeThemedVariables: boolean
  • cssvar.disableSort: boolean
    • Disables VSCode's default sorting functionality for this extension.
  • cssvar.enableColors: boolean
    • Enable CSS Variable color display everywhere.
    • If this config is changed, reload VSCode window.
  • cssvar.enableGotoDef: boolean
    • Enable VScode's Goto Definition feature for CSS Variables
    • If this config is changed, reload VSCode window.
  • cssvar.postcssPlugins: string[]
  • cssvar.postcssSyntax: string[]

Following are defaults, which you can override in your User settings.json or Workspace settings.json.

  • cssvar.files: ["index.css"]
  • cssvar.extensions: ["css", "scss", "sass", "less"]
  • cssvar.themes: []
  • cssvar.excludeThemedVariables: false
  • cssvar.disableSort: false
  • cssvar.enableColors: true
  • cssvar.enableGotoDef: true
  • cssvar.postcssPlugins: []
  • cssvar.postcssSyntax: []

Screeshots:

How to Install

How to install

Working Example

Working Example

Show Variable Colors

Var Colors

Supports Goto Definitions

Var Goto Definition

Theming Support:

Theming

Exclude Themed Variables

NOTE: Please raise an issue for any feature request or a bug fix.