postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
597 stars 77 forks source link

Feature request : Add browserslist support #162

Open rs459 opened 5 years ago

rs459 commented 5 years ago

I've made this, but having custom properties without fallback could be great when my browserslist support it.

var caniuse = require("caniuse-api");
var browserslist = require("browserslist");

var customPropertiesPreserve = caniuse.isSupported("css-variables", browserslist());

module.exports = {
    plugins: {
        'postcss-normalize':{},
        'autoprefixer':{},
        'postcss-custom-properties':{
            'preserve': customPropertiesWithFallback
        },
        'postcss-custom-media':{},
        'postcss-media-minmax':{}
    }
};