PostCSS plugin to polyfill background rgba for IE8
The origin artile Cross browser alpha transparent background CSS (rgba) is removed now. You can see this anwser from stackoverflow.
$ npm install postcss-bgc-rgba-fallback
// dependencies
var fs = require('fs')
var postcss = require('postcss')
var bgcRgbaFallback = require('postcss-bgc-rgba-fallback')
// css to be processed
var css = fs.readFileSync('input.css', 'utf8')
// process css
var output = postcss()
.use(bgcRgbaFallback())
.process(css)
.css
.foo {
background-color: rgba(255,102,0,0.3);
}
.foo {
background-color: rgb(255,102,0);
background-color: transparent\9;
background-color: rgba(255,102,0,0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4cFF6600, endColorstr=#4cFF6600);
zoom: 1;
}
.foo:nth-child(n) {
filter: none;
}