From f053c4c6849770fd46816bc636a125594e40b837 Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Wed, 29 May 2019 17:48:03 +0300 Subject: [PATCH] fix: handle all at-rules (#64) --- src/replaceSymbols.js | 6 +----- test/replaceSymbols.test.js | 6 ++++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/replaceSymbols.js b/src/replaceSymbols.js index c12ecc1..21418b6 100644 --- a/src/replaceSymbols.js +++ b/src/replaceSymbols.js @@ -9,11 +9,7 @@ const replaceSymbols = (css, replacements) => { node.selector.toString(), replacements ); - } else if ( - node.type === "atrule" && - node.params && - ["media", "supports"].includes(node.name.toLowerCase()) - ) { + } else if (node.type === "atrule" && node.params) { node.params = replaceValueSymbols(node.params.toString(), replacements); } }); diff --git a/test/replaceSymbols.test.js b/test/replaceSymbols.test.js index bf6e189..747e7df 100644 --- a/test/replaceSymbols.test.js +++ b/test/replaceSymbols.test.js @@ -17,8 +17,10 @@ test("not change property names", () => { ); }); -test("not change non-media at-rules", () => { - expect(replace("@import url;", { url: "otherUrl" })).toEqual("@import url;"); +test("change non-media at-rules", () => { + expect(replace("@import url;", { url: "otherUrl" })).toEqual( + "@import otherUrl;" + ); }); test("change declaration values", () => {