Fixed #668 - node v4 path.join.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 15 Sep 2015 05:54:42 +0000 (06:54 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 15 Sep 2015 06:33:04 +0000 (07:33 +0100)
Backporting node v4 fix as path.join does not accept undefined as
a parameter anymore.

History.md
lib/urls/rewrite.js
test/module-test.js

index 251b5e5..f3509be 100644 (file)
@@ -1,3 +1,8 @@
+[3.4.3 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.2...3.4)
+==================
+
+* Fixed issue [#668](https://github.com/jakubpawlowicz/clean-css/issues/668) - node v4 path.join.
+
 [3.4.2 / 2015-09-14](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.1...v3.4.2)
 ==================
 
index 4d7b2c1..f2f1152 100644 (file)
@@ -35,12 +35,12 @@ function isData(uri) {
 
 function absolute(uri, options) {
   return path
-    .resolve(path.join(options.fromBase, uri))
+    .resolve(path.join(options.fromBase || '', uri))
     .replace(options.toBase, '');
 }
 
 function relative(uri, options) {
-  return path.relative(options.toBase, path.join(options.fromBase, uri));
+  return path.relative(options.toBase, path.join(options.fromBase || '', uri));
 }
 
 function normalize(uri) {
index c6ac3f2..5b42586 100644 (file)
@@ -66,6 +66,14 @@ vows.describe('module tests').addBatch({
       assert.lengthOf(errors, 1);
     }
   },
+  'with callback passed to remote import': {
+    topic: function () {
+      new CleanCSS({ processImportFrom: ['local'] }).minify('@import url(https://fonts.googleapis.com/css?family=Open+Sans);', this.callback);
+    },
+    'should yield no error and minify': function (errors, minified) {
+      assert.equal(minified.styles, '@import url(https://fonts.googleapis.com/css?family=Open+Sans);');
+    }
+  },
   'no debug': {
     'topic': function () {
       return new CleanCSS().minify('a{ color: #f00 }');