* Fixed issue [#165](https://github.com/GoalSmashers/clean-css/issues/165) - extra space after trailing parenthesis.
* Fixed issue [#186](https://github.com/GoalSmashers/clean-css/issues/186) - strip unit from 0rem.
* Fixed issue [#207](https://github.com/GoalSmashers/clean-css/issues/207) - bug in parsing protocol `@import`s.
+* Fixed issue [#213](https://github.com/GoalSmashers/clean-css/issues/213) - faster rgb to hex transforms.
[2.0.7 / 2014-01-16](https://github.com/GoalSmashers/clean-css/compare/v2.0.6...v2.0.7)
==================
return {
process: function() {
return data.replace(/rgb\((\d+),(\d+),(\d+)\)/g, function(match, red, green, blue) {
- var redAsHex = parseInt(red, 10).toString(16);
- var greenAsHex = parseInt(green, 10).toString(16);
- var blueAsHex = parseInt(blue, 10).toString(16);
-
- return '#' +
- ((redAsHex.length == 1 ? '0' : '') + redAsHex) +
- ((greenAsHex.length == 1 ? '0' : '') + greenAsHex) +
- ((blueAsHex.length == 1 ? '0' : '') + blueAsHex);
+ // Credit: Asen http://jsbin.com/UPUmaGOc/2/edit?js,console
+ return '#' + ('00000' + (red << 16 | green << 8 | blue).toString(16)).slice(-6);
});
}
};