Preserving non-local imported files.
authorGoalSmashers <jakub@goalsmashers.com>
Fri, 29 Mar 2013 23:17:03 +0000 (00:17 +0100)
committerGoalSmashers <jakub@goalsmashers.com>
Fri, 29 Mar 2013 23:19:43 +0000 (00:19 +0100)
lib/clean.js
test/unit-test.js

index 9ae2efa..0bb9804 100644 (file)
@@ -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;
index bec7b7a..9810c9a 100644 (file)
@@ -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);",
       ""