* Requires Node.js 4.0+ to run.
+[3.4.6 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.5...3.4)
+==================
+
+* Fixed issue [#679](https://github.com/jakubpawlowicz/clean-css/issues/679) - wrong rebasing of remote URLs.
+
[3.4.5 / 2015-09-28](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.4...v3.4.5)
==================
return /^[^:]+?:\/\//.test(uri) || uri.indexOf('//') === 0;
}
+function isSameOrigin(uri1, uri2) {
+ return url.parse(uri1).protocol == url.parse(uri2).protocol &&
+ url.parse(uri1).host == url.parse(uri2).host;
+}
+
function isImport(uri) {
return uri.lastIndexOf('.css') === uri.length - 4;
}
if (isRemote(uri) && !isRemote(options.toBase))
return uri;
+ if (isRemote(uri) && !isSameOrigin(uri, options.toBase))
+ return uri;
+
if (!isRemote(uri) && isRemote(options.toBase))
return url.resolve(options.toBase, uri);
nock.cleanAll();
}
},
+ 'of an existing file with absolute URLs in different domain': {
+ topic: function () {
+ this.reqMocks = nock('http://127.0.0.1')
+ .get('/base.css')
+ .reply(200, 'a{background:url(http://example.com/deeply/images/test.png)}');
+
+ new CleanCSS().minify('@import url(http://127.0.0.1/base.css);', this.callback);
+ },
+ 'should not raise errors': function (errors, minified) {
+ assert.isNull(errors);
+ },
+ 'should process @import': function (errors, minified) {
+ assert.equal(minified.styles, 'a{background:url(http://example.com/deeply/images/test.png)}');
+ },
+ teardown: function () {
+ assert.isTrue(this.reqMocks.isDone());
+ nock.cleanAll();
+ }
+ },
'of an unreachable domain': {
topic: function () {
new CleanCSS().minify('@import url(http://0.0.0.0/custom.css);a{color:red}', this.callback);