postcss / autoprefixer

Parse CSS and add vendor prefixes to rules by Can I Use
https://twitter.com/autoprefixer
MIT License
21.58k stars 1.25k forks source link

CSS Variables #1445

Closed syahid-dev closed 2 years ago

syahid-dev commented 2 years ago

Hi! I'm using Autoprefixer in Visual Studio Code, and when im run it, its not change css variables to value. Example, my CSS is :

:root {
  --bg-blue: lightblue;
}
#mydiv {
  background-color: var(--bg-blue);
}

Autoprefixer not change anything, im want my CSS convert to :

#mydiv {
  background-color: lightblue;
}

Maybe its wrong in extension.... or in build version its same?

ai commented 2 years ago

Autoprefixer is dealing with vendor prefixes, not Custom Properties.

For Custom Properties you need to use PostCSS with postcss-preset-env.

Dan503 commented 2 years ago

For reference

https://preset-env.cssdb.org/features/#custom-properties