From d22ecc4c51f7aeecceb664499f51df04d623b73b Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Tue, 15 Sep 2015 06:54:42 +0100 Subject: [PATCH] Fixed #668 - node v4 path.join. Backporting node v4 fix as path.join does not accept undefined as a parameter anymore. --- History.md | 5 +++++ lib/urls/rewrite.js | 4 ++-- test/module-test.js | 8 ++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/History.md b/History.md index 251b5e5a..f3509be6 100644 --- a/History.md +++ b/History.md @@ -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) ================== diff --git a/lib/urls/rewrite.js b/lib/urls/rewrite.js index 4d7b2c11..f2f1152d 100644 --- a/lib/urls/rewrite.js +++ b/lib/urls/rewrite.js @@ -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) { diff --git a/test/module-test.js b/test/module-test.js index c6ac3f25..5b425863 100644 --- a/test/module-test.js +++ b/test/module-test.js @@ -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 }'); -- 2.34.1