From 18f7c63dec02d36ef94ed208430794c23a028d25 Mon Sep 17 00:00:00 2001 From: GoalSmashers Date: Sat, 30 Mar 2013 00:17:03 +0100 Subject: [PATCH] Preserving non-local imported files. --- lib/clean.js | 3 +++ test/unit-test.js | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/clean.js b/lib/clean.js index 9ae2efa0..0bb9804b 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -367,6 +367,9 @@ var CleanCSS = { .substring(data.indexOf('(', nextStart) + 1, nextEnd) .replace(/['"]/g, ''); + if (/^(http|https):\/\//.test(importedFile)) + return "@import url(" + importedFile + ");"; + var relativeTo = importedFile[0] == '/' ? options.root : options.relativeTo; diff --git a/test/unit-test.js b/test/unit-test.js index bec7b7a3..9810c9ab 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -734,10 +734,15 @@ title']", "@import url();", "" ], - 'of unknown file': [ + 'of an unknown file': [ "@import url('fake.css');", "" ], + 'of a http file': "@import url(http://pro.goalsmashers.com/test.css);", + 'of a https file': [ + "@import url('https://pro.goalsmashers.com/test.css');", + "@import url(https://pro.goalsmashers.com/test.css);" + ], 'of a directory': [ "@import url(test/data/partials);", "" -- 2.34.1