Giter Site home page Giter Site logo

vscode-style-vars-panel's Introduction

Access your style variables from a side panel (CSS, SASS, LESS, PostCSS...)

Variables matching

If you use SASS, LESS, PostCSS or any CSS prepocessor, you probably use variables to set colors, font sizes, dimentions... And if you integrate your UI from images provided by your design team, you probably try to match the colors from the design with your existing variables. This process is not fun and it's temptating to use a color picker and just paste static values.

The good new is that if you do take this lazy route, it's ok! The style vars side panel will read the value at your cursor position and display your best matching variables. Click on the one you want to insert and youre done!

It makes it also supper easy to update your existing code to use more variables.

How to use it:

To open the panel, run this vscode command: > Show style vars panel

Right now this extention is not able to gather the available variables accros your project. So you have to provide the list yourself:

File: .vscode/style-vars.json

{
  "$red": "#f00",
  "$my-font": "Times, serif"
  // ...
}

Those variables will be automatically sorted and categorized (color, dimention, other...)

If you are using SCSS, you can generate this file easily with extract-sass-vars:

npm i -g extract-sass-vars
extract-sass-vars yourVariablesFile.scss > .vscode/style-vars.json

To keep it up to date, add a postinstall script in your package.json ;)

PRs are welcome!

vscode-style-vars-panel's People

Contributors

testerez avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.