From 66b3ebd06f2a33c82fd90d2f0a0872d9adf063c3 Mon Sep 17 00:00:00 2001 From: Ying Li Date: Tue, 28 Nov 2017 19:28:45 +0900 Subject: [PATCH] Add support for @supports --- lib/combine-mq.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/combine-mq.js b/lib/combine-mq.js index 34a4355..87b63b9 100755 --- a/lib/combine-mq.js +++ b/lib/combine-mq.js @@ -116,6 +116,8 @@ strCss += processMedia(rule); } else if (rule.type === 'keyframes') { strCss += processKeyframes(rule); + } else if (rule.type === 'supports') { + strCss += processSupports(rule); } return strCss; @@ -171,6 +173,19 @@ return strCss; }; + // Process supports + var processSupports = function (supports) { + var strCss = '@supports ' + supports.supports + ' {'; + + supports.rules.forEach(function (rule) { + strCss += commentOrRule(rule); + }); + + strCss += '}'; + + return strCss; + }; + // Process document var processDocument = function(doc) { var strCss = '@' + (typeof doc.vendor !== 'undefined' ? doc.vendor : '') + 'document ' + doc.document + ' {'; @@ -273,7 +288,7 @@ processedCSS.document.push(rule); } else if (rule.type === 'charset') { processedCSS.charset.push(rule); - } else if (rule.type === 'rule' || 'comment') { + } else if (rule.type === 'rule' || 'comment' || 'supports') { processedCSS.base.push(rule); }