var FreeTextProcessor = require('./text/free');
var UrlsProcessor = require('./text/urls');
var NameQuotesProcessor = require('./text/name-quotes');
+var CommaSplitter = require('./text/comma-splitter');
var SelectorsOptimizer = require('./selectors/optimizer');
});
// transparent rgba/hsla to 'transparent' unless in compatibility mode
- if (!options.compatibility)
- replace(/(rgba|hsla)\(\d+,\d+%?,\d+%?,0\)/g, 'transparent');
+ if (!options.compatibility) {
+ replace(/:([^;]*)(?:rgba|hsla)\(\d+,\d+%?,\d+%?,0\)/g, function (match, prefix) {
+ if (new CommaSplitter(match).split().pop().indexOf('gradient(') > -1)
+ return match;
+
+ return ':' + prefix + 'transparent';
+ });
+ }
// none to 0
replace(/outline:none/g, 'outline:0');
],
'keeps rgba(0,0,0,.5)': 'a{color:rgba(0,0,0,.5)}',
'keeps rgba(0,255,0,.5)': 'a{color:rgba(0,255,0,.5)}',
- 'keeps hsla(120,100%,50%,.5)': 'a{color:hsla(120,100%,50%,.5)}'
+ 'keeps hsla(120,100%,50%,.5)': 'a{color:hsla(120,100%,50%,.5)}',
+ 'keeps rgba(0,0,0,0) when inside a gradient': 'a{background:linear-gradient(0,#000,rgba(0,0,0,0))}',
+ 'keeps hsla(120,100%,50%,0) when inside a gradient': 'a{background:linear-gradient(0,#000,hsla(120,100%,50%,0))}',
+ 'removes only right transparent colors': [
+ 'a{background-color:linear-gradient(0,#000,hsla(120,100%,50%,0)),rgba(0,0,0,0)}',
+ 'a{background-color:linear-gradient(0,#000,hsla(120,100%,50%,0)),transparent}'
+ ]
}),
'border-radius': cssContext({
'border radius H+V 0/0': [