* Fixed issue [#416](https://github.com/GoalSmashers/clean-css/issues/416) - accepts hash as `minify` argument.
* Fixed issue [#435](https://github.com/GoalSmashers/clean-css/issues/435) - background-clip in shorthand.
+[3.0.7 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.6...v3.0.7)
+==================
+
+* Fixed issue [#441](https://github.com/GoalSmashers/clean-css/issues/441) - hex to name color converting.
+
[3.0.6 / 2015-01-20](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.5...v3.0.6)
==================
}
var toHexPattern = new RegExp('(' + Object.keys(toHex).join('|') + ')( |,|\\)|$)', 'ig');
-var toNamePattern = new RegExp('(' + Object.keys(toName).join('|') + ')', 'ig');
+var toNamePattern = new RegExp('(' + Object.keys(toName).join('|') + ')([^a-f0-9]|$)', 'ig');
HexNameShortener.shorten = function (value) {
var hasHex = value.indexOf('#') > -1;
});
if (hasHex) {
- shortened = shortened.replace(toNamePattern, function(match, colorValue) {
- return toName[colorValue.toLowerCase()];
+ shortened = shortened.replace(toNamePattern, function(match, colorValue, suffix) {
+ return toName[colorValue.toLowerCase()] + suffix;
});
}
'transparent non-black hsla': [
'a{color:rgba(240,0,0,0)}',
['color:rgba(240,0,0,0)']
+ ],
+ 'partial hex to name': [
+ 'a{color:#f00000}',
+ ['color:#f00000']
+ ],
+ 'partial hex further down to name': [
+ 'a{background:url(test.png) #f00000}',
+ ['background:url(test.png) #f00000']
+ ],
+ 'partial name to hex': [
+ 'a{color:greyish}',
+ ['color:greyish']
+ ],
+ 'partial name further down to hex': [
+ 'a{background:url(test.png) blueish}',
+ ['background:url(test.png) blueish']
]
})
)