
UnRGBA changes rgba()
values to hex. This can be useful for outputting CSS for older browsers like Internet Explorer 8.
/* before */ /* after */
Usage
Add UnRGBA to your build tool:
npm install postcss-unrgba --save-dev
Node
/* options */ ;
PostCSS
Add PostCSS to your build tool:
npm install postcss --save-dev
Load UnRGBA as a PostCSS plugin:
;
Gulp
Add Gulp PostCSS to your build tool:
npm install gulp-postcss --save-dev
Enable UnRGBA within your Gulpfile:
var postcss = ; gulp;
Grunt
Add Grunt PostCSS to your build tool:
npm install grunt-postcss --save-dev
Enable UnRGBA within your Gruntfile:
grunt; grunt;
Options
method
Type: String
Default: 'replace'
clone
Copies any properties with rgba
values to new properties using hex.
/* before */ /* after */
replace
Copies any properties with rgba
values to new properties using hex while removing the original.
/* before */ /* after */
warn
Warns whenever a property with an rgba
value is found.
filter
Type: Boolean
Default: false
true
Uses the Internet Explorer proprietary filter to preserve alpha-transparent backgrounds.
/* before */ /* after */
false
Uses regular hexadecimal values when processing backgrounds.
/* before */ /* after */
properties
Type: Array
Default: ['background', 'background-color', 'color', 'border', 'border-bottom', 'border-bottom-color', 'border-color', 'border-left', 'border-left-color', 'border-right', 'border-right-color', 'border-top', 'border-top-color', 'outline', 'outline-color']
Specifies the properties on which rgba values will be processed. If a falsey value is passed then all properties will be processed.