From bb4a3bf66bf987223135c3d976e077ae19e074f6 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Sat, 4 Apr 2015 08:18:24 +0100 Subject: [PATCH] Fixes #511 - calc, parentheses and advanced optimizations. We're waiting for #429 to have it fixed properly, but here's an intermediate fix. --- History.md | 5 +++++ lib/properties/token.js | 2 +- test/integration-test.js | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/History.md b/History.md index 6f3e9194..86c25771 100644 --- a/History.md +++ b/History.md @@ -9,6 +9,11 @@ * Fixed issue [#397](https://github.com/jakubpawlowicz/clean-css/issues/397) - support for source map sources. * Fixed issue [#480](https://github.com/jakubpawlowicz/clean-css/issues/480) - extracting uppercase property names. +[3.1.9 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.1.8...3.1) +================== + +* Fixes issue [#511](https://github.com/jakubpawlowicz/clean-css/issues/511) - `)` advanced processing. + [3.1.8 / 2015-03-17](https://github.com/jakubpawlowicz/clean-css/compare/v3.1.7...v3.1.8) ================== diff --git a/lib/properties/token.js b/lib/properties/token.js index 2d030e31..102f9b8e 100644 --- a/lib/properties/token.js +++ b/lib/properties/token.js @@ -133,7 +133,7 @@ module.exports = (function() { t.prop + ':' + t.value + (t.isImportant ? important : ''); // FIXME: to be fixed with #429 - property = property.replace(/\) /g, ')'); + property = property.replace(/\) ([^\+\-\/\*])/g, ')$1'); list.push([property]); } diff --git a/test/integration-test.js b/test/integration-test.js index ce740dfe..54371dac 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -140,6 +140,10 @@ vows.describe('integration tests').addBatch({ 'body{width:calc((978px * 2/3) - 30px)}', 'body{width:calc((978px * 2/3) - 30px)}' ], + 'not inside calc method with brackets #3': [ + 'body{margin:calc(99.99% * 1/3 - (30px - 30px * 1/3) + 30px)}', + 'body{margin:calc(99.99% * 1/3 - (30px - 30px * 1/3) + 30px)}' + ], 'with space between braces': [ 'body{width:calc( ( 100% - 12px) / 3 )}', 'body{width:calc((100% - 12px)/ 3)}' -- 2.34.1