Socket
Socket
Sign inDemoInstall

postcss-css-variables

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-css-variables

PostCSS plugin to transform CSS Custom Properties(CSS variables) syntax into a static representation


Version published
Maintainers
1
Created

What is postcss-css-variables?

The postcss-css-variables package is a PostCSS plugin that enables the transformation of CSS custom properties (variables) into static values. This is particularly useful for ensuring compatibility with older browsers that do not support CSS variables.

What are postcss-css-variables's main functionalities?

Transforming CSS Variables

This feature allows you to define CSS variables and then use them throughout your stylesheet. The plugin will replace the variable usage with the actual value, ensuring compatibility with browsers that do not support CSS variables.

/* Input CSS */
:root {
  --main-color: #06c;
}

body {
  color: var(--main-color);
}

/* Output CSS */
body {
  color: #06c;
}

Fallback Values

You can provide fallback values for CSS variables. The plugin will replace the variable with the fallback value if the variable is not defined.

/* Input CSS */
:root {
  --main-color: #06c;
}

body {
  color: var(--main-color, #000);
}

/* Output CSS */
body {
  color: #06c;
}

Nested Variables

The plugin supports nested variables, allowing you to define a variable based on another variable. This can help in creating more dynamic and maintainable stylesheets.

/* Input CSS */
:root {
  --main-color: #06c;
  --secondary-color: var(--main-color);
}

body {
  color: var(--secondary-color);
}

/* Output CSS */
body {
  color: #06c;
}

Other packages similar to postcss-css-variables

Keywords

FAQs

Package last updated on 24 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc