From 2b90c64d6d3f545106cd0f6d157eb9fe4f368854 Mon Sep 17 00:00:00 2001 From: Andrey Taritsyn Date: Wed, 21 Jun 2017 20:42:14 +0300 Subject: [PATCH] In BundleTransformer.CleanCss added support of Clean-css version 4.1.4 --- .../BundleTransformer.CleanCss.nuspec | 5 ++-- NuGet/BundleTransformer.CleanCss/readme.txt | 7 ++++- .../Resources/clean-css-combined.js | 27 ++++++++++++------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/NuGet/BundleTransformer.CleanCss/BundleTransformer.CleanCss.nuspec b/NuGet/BundleTransformer.CleanCss/BundleTransformer.CleanCss.nuspec index 00351078b..6480f60f1 100644 --- a/NuGet/BundleTransformer.CleanCss/BundleTransformer.CleanCss.nuspec +++ b/NuGet/BundleTransformer.CleanCss/BundleTransformer.CleanCss.nuspec @@ -10,10 +10,11 @@ https://github.com/Taritsyn/BundleTransformer https://raw.githubusercontent.com/Taritsyn/BundleTransformer/master/images/icons/128/BundleTransformer_CleanCss_Logo_128x128.png false - BundleTransformer.CleanCss contains one minifier-adapter for minification of CSS code - `CleanCssMinifier`. `CleanCssMinifier` is based on the Clean-css (https://github.com/jakubpawlowicz/clean-css) version 4.1.3. + BundleTransformer.CleanCss contains one minifier-adapter for minification of CSS code - `CleanCssMinifier`. `CleanCssMinifier` is based on the Clean-css (https://github.com/jakubpawlowicz/clean-css) version 4.1.4. As a JS engine is used the JavaScript Engine Switcher library (https://github.com/Taritsyn/JavaScriptEngineSwitcher). For correct working of this module, you need to install one of the following NuGet packages: JavaScriptEngineSwitcher.Msie, JavaScriptEngineSwitcher.V8 or JavaScriptEngineSwitcher.ChakraCore. - BundleTransformer.CleanCss contains one minifier-adapter for minification of CSS code - `CleanCssMinifier`. `CleanCssMinifier` is based on the Clean-css version 4.1.3. + BundleTransformer.CleanCss contains one minifier-adapter for minification of CSS code - `CleanCssMinifier`. `CleanCssMinifier` is based on the Clean-css version 4.1.4. + Added support of Clean-css version 4.1.4. Copyright (c) 2012-2017 Andrey Taritsyn - http://www.taritsyn.ru en-US BundleTransformer System.Web.Optimization IBundleTransform ASP.NET CSS Bundling Minification Minifier Minify Clean-css diff --git a/NuGet/BundleTransformer.CleanCss/readme.txt b/NuGet/BundleTransformer.CleanCss/readme.txt index 0d313398c..d2353038f 100644 --- a/NuGet/BundleTransformer.CleanCss/readme.txt +++ b/NuGet/BundleTransformer.CleanCss/readme.txt @@ -13,11 +13,16 @@ =========== BundleTransformer.CleanCss contains one minifier-adapter for minification of CSS code - `CleanCssMinifier`. `CleanCssMinifier` is based on the Clean-css - (https://github.com/jakubpawlowicz/clean-css) version 4.1.3. + (https://github.com/jakubpawlowicz/clean-css) version 4.1.4. As a JS engine is used the JavaScript Engine Switcher library (https://github.com/Taritsyn/JavaScriptEngineSwitcher). + ============= + RELEASE NOTES + ============= + Added support of Clean-css version 4.1.4. + ==================== POST-INSTALL ACTIONS ==================== diff --git a/src/BundleTransformer.CleanCss/Resources/clean-css-combined.js b/src/BundleTransformer.CleanCss/Resources/clean-css-combined.js index 419de86bd..c572f4c66 100644 --- a/src/BundleTransformer.CleanCss/Resources/clean-css-combined.js +++ b/src/BundleTransformer.CleanCss/Resources/clean-css-combined.js @@ -47,7 +47,7 @@ if (!String.prototype.hasOwnProperty('repeat')) { } /*! - * Clean-css v4.1.3 + * Clean-css v4.1.4 * https://github.com/jakubpawlowicz/clean-css * * Copyright (C) 2017 JakubPawlowicz.com @@ -5582,7 +5582,8 @@ var CleanCss = (function(){ function removeUnusedAtRule(tokens, matchCallback, markCallback, context) { var atRules = {}; var atRule; - var token; + var atRuleTokens; + var atRuleToken; var zeroAt; var i, l; @@ -5597,9 +5598,13 @@ var CleanCss = (function(){ markUsedAtRules(tokens, markCallback, atRules, context); for (atRule in atRules) { - token = atRules[atRule]; - zeroAt = token[0] == Token.AT_RULE ? 1 : 2; - token[zeroAt] = []; + atRuleTokens = atRules[atRule]; + + for (i = 0, l = atRuleTokens.length; i < l; i++) { + atRuleToken = atRuleTokens[i]; + zeroAt = atRuleToken[0] == Token.AT_RULE ? 1 : 2; + atRuleToken[zeroAt] = []; + } } } @@ -5623,7 +5628,8 @@ var CleanCss = (function(){ if (token[0] == Token.AT_RULE_BLOCK && token[1][0][1].indexOf('@counter-style') === 0) { match = token[1][0][1].split(' ')[1]; - atRules[match] = token; + atRules[match] = atRules[match] || []; + atRules[match].push(token); } } @@ -5665,7 +5671,8 @@ var CleanCss = (function(){ if (property[1][1] == 'font-family') { match = property[2][1].toLowerCase(); - atRules[match] = token; + atRules[match] = atRules[match] || []; + atRules[match].push(token); break; } } @@ -5718,7 +5725,8 @@ var CleanCss = (function(){ if (token[0] == Token.NESTED_BLOCK && keyframeRegex.test(token[1][0][1])) { match = token[1][0][1].split(' ')[1]; - atRules[match] = token; + atRules[match] = atRules[match] || []; + atRules[match].push(token); } } @@ -5763,7 +5771,8 @@ var CleanCss = (function(){ if (token[0] == Token.AT_RULE && token[1].indexOf('@namespace') === 0) { match = token[1].split(' ')[1]; - atRules[match] = token; + atRules[match] = atRules[match] || []; + atRules[match].push(token); } }