if (rebaseOpts.relative)
rebaseOpts.toBase = path.resolve(path.dirname(options.target));
- if (rebaseOpts.absolute && (!rebaseOpts.fromBase || !rebaseOpts.toBase))
- return data;
-
return UrlRewriter.process(data, rebaseOpts);
}
};
if (!options.absolute && !options.relative)
throw new Error('Relative url found: \'' + url + '\' but there is no way to resolve it (hint: use `root` or `output` options)');
+ if (!options.fromBase || !options.toBase)
+ return url;
+
if (options.absolute) {
rebased = path
.resolve(path.join(options.fromBase, url))
teardown: function() {
deleteFile('./base2-min.css');
}
+ }),
+ 'piped with output': pipedContext('a{background:url(test/data/partials/extra/down.gif)}', '-o base3-min.css', {
+ 'should keep paths as they are': function() {
+ var minimized = readFile('base3-min.css');
+ assert.equal(minimized, 'a{background:url(test/data/partials/extra/down.gif)}');
+ },
+ teardown: function() {
+ deleteFile('base3-min.css');
+ }
})
},
'complex import and url rebasing': {