* Requires Node.js 4.0+ to run.
+[3.4.12 / 2016-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.11...3.4)
+==================
+
+* Fixed issue [#734](https://github.com/jakubpawlowicz/clean-css/issues/734) - `--root` option edge case.
+
[3.4.11 / 2016-04-01](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.10...v3.4.11)
==================
target: commands.output
};
-if (options.root || commands.args.length > 0)
- options.relativeTo = path.dirname(path.resolve(options.root || commands.args[0]));
+if (options.root || commands.args.length > 0) {
+ var relativeTo = options.root || commands.args[0];
+
+ if (isRemote(relativeTo)) {
+ options.relativeTo = relativeTo;
+ } else {
+ var resolvedRelativeTo = path.resolve(relativeTo);
+
+ options.relativeTo = fs.statSync(resolvedRelativeTo).isFile() ?
+ path.dirname(resolvedRelativeTo) :
+ resolvedRelativeTo;
+ }
+}
if (options.sourceMap && !options.target) {
outputFeedback(['Source maps will not be built because you have not specified an output file.'], true);
});
}
+function isRemote(path) {
+ return /^https?:\/\//.test(path) || /^\/\//.test(path);
+}
+
function processImportFrom(rules) {
if (rules.length === 0) {
return ['all'];
})
}
})
+ .addBatch({
+ 'relative import with just a filename': pipedContext('@import "one.css";', '-r ./test/fixtures/partials', {
+ 'imports sources correctly': function(error, stdout) {
+ assert.equal(error, null);
+ assert.include(stdout, '.one{color:red}');
+ }
+ }),
+ 'relative import with ./': pipedContext('@import "./one.css";', '-r ./test/fixtures/partials', {
+ 'imports sources correctly': function(error, stdout) {
+ assert.equal(error, null);
+ assert.include(stdout, '.one{color:red}');
+ }
+ })
+ })
.addBatch({
'remote import': {
topic: function () {